ASCII-code Ordering

Source: Internet
Author: User

ASCII code sorting time limit:  ms  |  Memory limit:65535  KB Difficulty:2 description after entering three characters (which can be repeated), the ASCII code of each character is printed in the order of three characters from small to large. Enter the first line to enter a number n, indicating that there are n sets of test data. The next n rows enter multiple sets of data, each with a row of three characters and no spaces between them. Output for each set of input data, output one line, the middle of the character separated by a space. Sample input 2QWEASD sample output e q WA d s
Package ACM1; //In the submission of the question, note that this place to delete the import java.util.arrays;import java.util.Scanner; Public classNYOJW2 //Submit the name of the class changed to main{ Public Static voidMain (String[]args) {intn,i,j; Scanner Scanner=NewScanner (System.inch); N=Scanner.nextint ();  for(j=0; j<n;j++) {String str=NewString (); Char[]ch =New Char[3]; STR=Scanner.next (); //Gets the input string  for(i=0;i<3; i++) {Ch[i]=Str.charat (i); //Read the STR string into the ch[] array.            CharAt (i) I represents the I-character of this string } arrays.sort (CH); System. out. println (ch[0]+" "+ch[1]+" "+ch[2]); }          }    }

ASCII-code Ordering

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.