1503171912-ny-a water question

Source: Internet
Author: User

1503171912-ny-a water question
A water Question Time Limit: 1000 MS | memory limit: 65535 KB difficulty: 2

Description
Today, LZQ is playing a small game, but the number of this game is a little big. He is a little tired and wants to pull some people in to help him. Can you write a program to help him? This game is like this: there is a line of numbers. If we regard '5' in this line of numbers as spaces, then several non-negative integers (some integers may start with '0' and the '0' of these headers should be ignored, unless this integer is composed of several '0', then this integer is 0 ).
Your task is to sort and output the generated integers in ascending order. Please write a program to help LZQ!
Input
The input contains multiple groups of test cases. Each group of input data has only one row of numbers (no space between numbers), and the length of this line of numbers is not greater than 5000.

Input data guarantee: The calculated non-negative integer is not greater than 100000000. If all input data is 5, 0 is output.
 
Output
For each test case, the result of sorting the separated integers is output. Two Adjacent integers are separated by a space. Each group of output occupies one row.
 
Sample Input
0051231232050775
Sample output
0 77 12312320
Solutions
Pay attention to the following situations:
1. Start with 5
2. The end is not 5
3. 5 consecutive in the middle (I forgot to think about it. Please pay attention to it)
Code
 
    
#include
     
       #include
      
        #include using namespace std; char s[5100]; int num[5100]; int main() { int i,j,k; int len; int now; while(scanf("%s",s)!=EOF) { len=strlen(s); for(i=0;i
       
      
     

Related Article

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.