-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ03004.java
More file actions
28 lines (25 loc) · 875 Bytes
/
J03004.java
File metadata and controls
28 lines (25 loc) · 875 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
package CODE_PTIT;
import java.util.*;
public class J03004 {
public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
int t = Integer.parseInt(inp.nextLine());
while (t-- > 0) {
String s = inp.nextLine();
s = s.toLowerCase();
System.out.println(s);
String[] res = s.split("\\s+");
StringBuilder builder = new StringBuilder();
for (String i : res) {
if (i.length() > 0) {
char[] C = i.toCharArray();
C[0] = Character.toUpperCase(C[0]);
builder.append(new String(C));
builder.append(" ");
}
}
String ans = builder.toString().trim();
System.out.println(ans);
}
}
}