HDU 2026 initial capitalization (Java)

Source: Internet
Author: User

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)

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.