HUAWEI OD machine test-picture organization (C++ & Java & JS & Python)

describe

Lily uses alphanumeric pictures to teach children to learn English words in class, and needs to arrange these pictures according to size (ASCII code value from small to large) every time. Please help Lily and solve it through code.

The pictures Lily uses are represented by the characters "A" through "Z", "a" through "z", "0" through "9".

Data range: the length of each input string satisfies 1≤�≤1000 1≤n≤1000 

Enter a description:

A line, a string, each character in the string represents a picture used by Lily.

Output description:

All pictures of Lily are output in ascending order

Example 1

enter:

Ihave1nose2hands10fingers

output:

0112Iaadeeefghhinnnorsssv

Java:

import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner in=new Scanner(System.in);
        while(in.hasNext()){
            int a[]=new int[128];
            String str=in.next();
            for(int i=0;i<str.length();i++){
                int k=str.charAt(i);//统计出现次数
     

Guess you like

Origin blog.csdn.net/m0_68036862/article/details/132716649