C. A string has three paragraphs. The first segment is output as is, the second segment is the length of the string to be output, and the third segment is filled with the first segment according to the second segment length.

Source: Internet
Author: User

C. A string has three paragraphs. The first segment is output as is, the second segment is the length of the string to be output, and the third segment is filled with the first segment according to the second segment length.

For example, input ABC 11 12 and output abc12121212.


# Include <stdio. h>
# Include <string. h>
Int main (){
Char A [1, 100], B [2, 100];
Int Len = 0, I, J;
Int flag, T;
Gets ();
For (I = 0; A [I]! = ''; I ++ ){
B [I] = A [I];
}
T = I;
For (j = I + 1; A [J]! = ''; J ++ ){
Len = Len * 10;
Len = Len + A [J]-'0 ';
}
Flag = J + 1;
While (T <Len)
{
If (A [flag]! = '\ 0 ')
{
B [T] = A [flag];
T ++;
Flag ++;

}
Else if (a [flag] = '\ 0 ')
Flag = J + 1;

}
B [Len] = '\ 0 ';
Puts (B );
Return 0;
}

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.