#C13705. Remove Adjacent Duplicates
Remove Adjacent Duplicates
Remove Adjacent Duplicates
You are given a sequence of strings. Your task is to remove adjacent duplicate strings while preserving the order of appearance.
For example, if the input list is a a b b c a a b
, then the output should be a b c a b
.
The operation only removes duplicates that are directly adjacent. Non-adjacent duplicate strings should be retained.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer n, representing the number of strings.
- The following n lines each contain a single non-empty string.
outputFormat
The output should be written to standard output (stdout) and consist of the processed list of strings with adjacent duplicates removed. The strings should be printed in order, separated by a single space.
## sample0