Write a program that reads from standard input (using getchar).
The first time a word appears in the text, it is left as is, but a unique number (starting with 0, then 1, etc.) is associated with it. For all subsequent occurrences of the word, it is replaced by its number.
for example:
To be or not to be
Or not to be or to be
would become:
To be or not to 1
Or 3 4 1 2 4 1
Note that spacing and line breaks have been preserved.
You may assume that there are at most 80 characters in any line.
The first time a word appears in the text, it is left as is, but a unique number (starting with 0, then 1, etc.) is associated with it. For all subsequent occurrences of the word, it is replaced by its number.
for example:
To be or not to be
Or not to be or to be
would become:
To be or not to 1
Or 3 4 1 2 4 1
Note that spacing and line breaks have been preserved.
You may assume that there are at most 80 characters in any line.