#B3654. Concatenation of Non-shadow Strings
Concatenation of Non-shadow Strings
Concatenation of Non-shadow Strings
You are given multiple strings, one per line. Some strings may appear multiple times. We define the concept of shadow string using the following explanation: if a string appears in multiple lines, only its first occurrence is considered as a non-shadow string, while all subsequent occurrences are its shadows. In other words, if a string ( s ) appears in lines ( i_1, i_2, \dots, i_k ) (with ( i_1 < i_2 < \dots < i_k )), then only the appearance at line ( i_1 ) is non-shadow and all others (lines ( i_2, \dots, i_k )) are shadow strings.
Your task is to concatenate all non-shadow strings in the order of their first appearance (i.e. ascending order of line number) and output the result as one long string.
inputFormat
The input consists of multiple lines. Each line contains a single string. The number of lines is not known in advance.
outputFormat
Output a single string which is the concatenation of all the non-shadow strings (i.e. the first occurrence of every string) in the order they appear.
sample
abc
def
abc
abc
abc
abcdef