Problem A
Fouled files

Aack! Your operating system went crazy and made a mess of all the text files on your hard drive. Fortunately, you know something about what happened. Each file originally had $\le 40$ characters per line, plus the original newline. The corruption process took each line and did two things: added a garbage character after each original character, and added possibly many garbage characters at the end of the line (but before the newline). Fortunately, you still know where the linebreaks are because newlines were (amazingly) not affected and there is no garbage on a line following a newline.

Since you’re handy with writing little ‘fixit’ utilities, write one that discards all text that must be garbage.


Input contains one file to fix. The first line contains an integer $1 \le n \le 100$. Following are $n$ lines, each containing up to $200$ characters from the set of ASCII letters, numbers, punctuation, and space.


Give the contents of the file after discarding text that must be garbage.

Sample Input 1 Sample Output 1
Tyh`iLse &i]s} ZaK [email protected] 4f$irl$e=!b
This is a broken file!
Sample Input 2 Sample Output 2
T$hNiTsX 'i\st 2aZ DvteirTyO =lJobnKgQ 1lSiZnfee DtFh^a6tc {iKs' Gmvour2es EtUh=ayn| "4
AvancVkX!7 RYRoluWr. Lonp9e+r$astJi/nxg+ Psqy%sptBeiml Uw^eQnntf lcjr7aKzWyh
aqn-dA xmDaTdbe' faT Jm#e2sBsp Wo&fX \a{l(lx qt6hSeO lfwihlfe/sv 6oSnf FyPoHu{r%
hwa_r5dk ed*r!i?v{e~.&
This is a very long line that is more th
Aack! Your operating system went crazy
and made a mess of all the files on your
hard drive.
CPU Time limit 1 second
Memory limit 1024 MB
Statistics Show
Greg Hamerly
Source Baylor Competitive Learning course
License Creative Commons License (cc by-sa)

Please log in to submit a solution to this problem

Log in