Quick row of arrays in Java

Source: Internet
Author: User

After describing the input three characters (which can be duplicated), the ASCII code of each character outputs the three characters in the order from small to large.

 
Input
the first line enters a number n, which indicates 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, the output line is separated by a space between the characters.
Sample input
3qweasdzxc
Sample output
e q wa d SC x z

1 Importjava.util.Arrays;2 ImportJava.util.Scanner;3 4  Public classMain {5      Public Static voidMain (string[] args) {6         intT;7Scanner scanner=NewScanner (system.in);8         Chara[]=New Char[3];9         Tent=scanner.nextint (); One          while(true){ A             if(t==0) -                  Break; -t--; the              -A=Scanner.next (). ToCharArray (); - Arrays.sort (a); -              +System.out.println (a[0]+ "" +a[1]+ "" +a[2]); -         } +     } A}




Quick row of arrays in 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.