This commit is contained in:
xixu-me committed 2024-05-24 16:43:34 +08:00
1 parent eec518632e
commit 7275bdb0e8
240 files changed
+22 -1

No files matched your search

@@ -0,0 +1,18 @@
package finalexam.StandardIO;
import java.util.Scanner;
public class StringInitialization {
public static void main(String[] var0) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
StringBuffer sb = new StringBuffer(s);
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
for (int i = 1; i < s.length(); ++i)
if (s.charAt(i - 1) != ',' && s.charAt(i - 1) != ' ')
sb.setCharAt(i, Character.toLowerCase(sb.charAt(i)));
else
sb.setCharAt(i, Character.toUpperCase(sb.charAt(i)));
System.out.println(sb);
}
}