-
Notifications
You must be signed in to change notification settings - Fork 0
/
J03004
33 lines (31 loc) · 941 Bytes
/
J03004
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
package test;
import java.util.*;
public class J03004 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
while(t-- >0){
String s = sc.nextLine();
Vector<String> a = new Vector<String>();
s = s.toLowerCase() + " ";
String x = "";
for(int i = 0; i < s.length(); i++){
if(s.charAt(i) == ' '){
if(x != ""){
a.add(x);
x = "";
}
}
else{
x += s.charAt(i);
}
}
for(int i = 0; i < a.size(); i++){
String k = a.get(i);
System.out.print(k.substring(0, 1).toUpperCase() + k.substring(1) + " ");
}
System.out.println();
}
}
}