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