-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCombinedlengthofstrings.java
More file actions
49 lines (42 loc) · 1010 Bytes
/
Copy pathCombinedlengthofstrings.java
File metadata and controls
49 lines (42 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.Scanner;
public class Combinedlengthofstrings {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
// int size=sc.nextInt();
// String[] arr=new String[size]; //array of strings
// int len=0;
// for(int i=0;i<size;i++)
// {
// arr[i]=sc.next();
// len+=arr[i].length();
// }
// System.out.println(len);
//replace char e of string
// String inputstr=sc.next();
// String res=""; //empty string as result
// for(int i=0;i<inputstr.length();i++)
// {
// if(inputstr.charAt(i)=='e')
// {
// res+='i'; //add i in place of e when encountered
// }
// else
// {
// res+=inputstr.charAt(i);
// }
// }
// System.out.println(res);
//print email only before @
String email=sc.next();
String username="";
for(int i=0;i<email.length();i++)
{
if(email.charAt(i)=='@')
break ; //comes out of loop
else
username+=email.charAt(i);
}
System.out.println(username);
}
}