Problem:
Lowercase is capitalized, previously in the form of A= (char) (A+32), and has no effect for unknown reasons.
There are functions: A[0]=character.touppercase (a[0]);
Capitalize the initial letterTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 37323 Accepted Submission (s): 20817
Problem description Enter an English sentence and change the first letter of each word to uppercase.
Input data contains multiple test instances, each of which is a single line of English sentences with a length of not more than 100.
Output please write the English sentences that are rewritten as required.
Sample Input
I like ACMI want to get an accepted
Sample Output
I like AcmI want to Get an Accepted
Code:
Import java.util.*;p ublic class main{public static void Main (String args[]) {Scanner cin=new Scanner (system.in); while ( Cin.hasnext ()) {String s;s=cin.nextline (); char[] A=s.tochararray (); A[0]=character.touppercase (A[0]); for (int i=1;i <s.length (); i++) if (a[i]== ") a[i+1]=character.touppercase (a[i+1]); for (int i=0;i<s.length (); i++) {if (i== S.length ()-1) System.out.println (A[i]); ElseSystem.out.print (A[i]);}}}
HDU 2026 initial capitalization (Java)