capitalize the initial letter
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others) total submission (s): 49003 Accepted Submission (s): 27058
problem DescriptionEnter an English sentence and change the first letter of each word to uppercase. InputThe input data contains multiple test instances, each of which is a line of English sentences with a length of not more than 100. OutputPlease output the English sentences that have been rewritten as required. Sample InputI like ACMI want to get an accepted Sample OutputI like AcmI want to Get an Accepted
1#include <iostream>2#include <string>3 using namespacestd;4 intMain () {5 strings;6 while(Getline (CIN, s)) {7 Charc =' ';8 for(inti =0; I < s.length (); i++){9 if(c = =' '){TenS[i] = s[i]-'a'+'A'; One } Ac =S[i]; - } -cout << S <<Endl; the } - return 0; -}
View Code
1#include <iostream>2#include <string>3 using namespacestd;4 intMain () {5 strings;6 while(Getline (CIN, s)) {7 for(inti =0; I < s.length ()-1; i++){8 if(S[i] = =' ' )9s[i+1] = s[i+1] -'a'+'A';Ten if(i = =0) OneS[i] = s[i]-'a'+'A'; A } -cout << S <<Endl; - } the return 0; -}
HDU 2026 initials to uppercase