Wuhan University of Science and Technology acm:1003: Chinese Edition C language Programming tutorial (second Edition) example 6.6. Adaptation

Source: Internet
Author: User

Problem Description

Wowapps most like to learn English, English class never skip class, but English has not been learned, because the class has been sleeping. Why do you sleep, because he thinks the English word is too long. Now Wowapps has a long, long, long word and wants to compress it. Can you help him?

Compression: Replaces consecutive repeating letters with one, see sample for details.

Input

Enter an n first to indicate the number of words Wowapps give (1<= n <= 10086)

Next n lines, each behavior of a string, the length is not greater than 73, the data is guaranteed to be English letters, does not contain other characters.

Output

Outputs n rows, each of which acts as a compressed new word.

Sample Input
1abbcccddddeeeeef
Sample Output
ABCdef
HINT

Note: read one line, process one line

You can use a structure similar to the following:

scanf ("%d", &n);

GetChar ();

while (n--)

{

Gets (s);

.......

}

The following topics are similar

1#include <stdio.h>2 intMain ()3 {4     Chars[ About];5     intN;6      while(SCANF ("%d", &n)! =EOF)7     {8          for(intk=0; k<n;k++)9         {Tenscanf"%s", s); One             Char* p=s; A              -             Charbuf[ -]; -              the             Char* Q =p; -             intI=0; -              for(;*q;) -             { +                 if(q==p| | *q! = * (q1)) -                 { +buf[i++] = *Q; A                 } atq++; -             } -Buf[i] =' /';  -printf"%s\n", buf); -         } -          in     } -      to      +     return 1; -}

Wuhan University of Science and Technology acm:1003: Chinese Edition C language Programming tutorial (second Edition) example 6.6. Adaptation

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.