Hello, my prof gave us a problem from the ACM programming contest, we are supposed to write a program that takes a compressed file as input and generates a reproduction of the original uncompressed file as output,
the compression scheme requires making a list of the words in the uncompressed file. When a non-alphabetic character is encountered in the uncompressed file, it is copied directly into the compressed file. When a word is encountered in the uncompressed file, it is copied directly into the compressed file only if this is the first occurrence of the word. In that case, the word is put at the front of the list. If it is not the first occurrence, the word is not copied to the compressed file. Instead, its position in the list is copied into the compressed file and the word is moved to the front of the list. The numbering of list positions begins at 1,
like the sample input would be :
Dear Sally,
Please, please do it--1 would 4
Mary very, 1 much. And 4 6
8 everything in 5's power to make
14 pay off for you.
-- Thank 2 18 18--
0
sample output would be
dear Sally,
Please, please do it--it would please
Mary very, very much. And Mary would
do everything in Mary's power to make
it pay off for you.
-- Thank you very much--
so yeah, i dont even know where to start :sad: