Sort ACM--ASCII Codes

Source: Internet
Author: User

Original question address

Description

After three characters are entered (repeated), the three characters are output in ascending order of the ASCII code of each character.

Input

Enter N in the first line, indicating that there are N groups of test data. The next n rows Input Multiple groups of data. Each group of input data occupies one row and consists of three characters without spaces.

Output

For each group of input data, one line is output, separated by a space.

Sample Input

3

Qwe
ASD
Zxc

Sample output

§ E Q W
A D S
C x Z


The Code is as follows:

public static void main(String[] args){Scanner sc = new Scanner(System.in);int count = sc.nextInt();while(count > 0){String str = sc.next();char[] chr = str.toCharArray();java.util.Arrays.sort(chr);for(int j = 0; j < chr.length; j++){System.out.print(chr[j]+" ");}count --;}}

 

Please do not give me any advice on what is better about all roads.


This article from "One step at a footprint" blog, please be sure to keep this source http://wangrz421.blog.51cto.com/6243726/1549004

Sort ACM--ASCII Codes

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.