HDU 2026 initials to uppercase

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.