410059: GYM103934 G Mmoohhaammeedd

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Mmoohhaammeeddtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Egyptian names can be confusing sometimes. For instance, in a classroom, we may have students named Mohamed, Muhammad, Mohammed, Mohammad and Mohamad. While any of them is upset when people write his name wrong, no one suffers more than Mmoohhaammeedd.

Cursed by his parents that wanted a special name for him, Mmoohhaammeedd was bullied by his classmates throughout his life. Now, he asks your help to, finally, plan his revenge.

Mmoohhaammeedd got the attendance list of his school. Now, he will make a new one, changing the name of each of his classmates in the following way: Mmoohhaammeedd will duplicate each letter whose neighboring letters are different from it. In this way, "eman" turns into "eemmaann", "hasssan" turns into "hhaasssaann", "alaa" turns into "aallaa" and "mmoohhaammeedd" remains the same.

Given the name of one of Mmoohhaammeedd's classmates, print how he should write it in the attendance list.

Input

The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 100$$$), the number of testcases, and it is followed by $$$n$$$ lines containing the names. Each name has at least one and most 100 characters, and consists of lowercase latin letters.

Output

The output consists of $$$n$$$ lines, each one containing a name after the transformation of Mmoohhaammeedd.

ExamplesInput
4
aba
aabbaa
aaaa
aabaa
Output
aabbaa
aabbaa
aaaa
aabbaa
Input
4
eman
hasssan
alaa
mmoohhaammeedd
Output
eemmaann
hhaasssaann
aallaa
mmoohhaammeedd

Source/Category

加入题单

上一题 下一题 算法标签: