HDU ASCII code sequencing

Source: Internet
Author: User

http://acm.hdu.edu.cn/showproblem.php?pid=2000

Problem description Input Three characters, the ASCII code of each character is printed in order from small to large to output these three characters. Input data has more than one group, each of which consists of three characters and no spaces between them. Output for each set of input data, one line is printed, and the characters are separated by a space. Sample INPUTQWEASDZXC sample Outpute q wa d sc x z code:
#include <bits/stdc++.h>using namespace Std;char s[111];int main () {    while (scanf ("%s", s)!=eof)    {        int len = strlen (s);        for (int i=0, i<len; i++)        {for            (int j=i; j>=1; j--)            {                if (s[j]<=s[j-1])                    swap (s[j],s[j-1]) ;            }        }        for (int i=0; i<len; i++)        {            if (i!=len-1)                printf ("%c", S[i]);            else                printf ("%c\n", S[i]);        }    }    return 0;}

  

HDU ASCII code sequencing

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.