快熄灯了,写得很乱就submit了,没办法。
1 import java.util.*;
2
3 public class Main {
4 public static void main(String[] args){
5 Scanner cin=new Scanner(System.in);
6 ArrayList<String> arrayList=new ArrayList<String>();
7 int arrayLength=0;
8 int t=cin.nextInt();
9 String temp=cin.nextLine();
10 for(int i=0;i<t;i++){
11 temp=cin.nextLine();
12 arrayLength=temp.length();
13 char[] array=new char[10000];
14 temp.getChars(0, temp.length(), array, 0);
15
16 array[0]=Character.toUpperCase(Character.valueOf(array[0]));
17
18 for(int j=0;j<arrayLength;j++){
19 if(array[j]!=' '){
20 array[j+1]=Character.toLowerCase(Character.valueOf(array[j+1]));
21 }
22 }
23
24 arrayList.add(String.copyValueOf(array));
25 }
26 for(String out:arrayList){
27 System.out.println(out);
28 }
29 }
30 }