#K39212. Remove Consecutive Duplicates

    ID: 26371 Type: Default 1000ms 256MiB

Remove Consecutive Duplicates

Remove Consecutive Duplicates

You are given a list of strings. Your task is to remove consecutive duplicate strings and output the resulting list.

For example, if the input is:

foo
foo
bar
bar
baz
foo
foo

Then the output should be:

foo bar baz foo

The problem tests your ability to process sequences and handle consecutive duplicate removal.

Note: The solution should read from stdin and print the answer to stdout.

inputFormat

The first line contains a single integer \( N \) representing the number of strings.

The following \( N \) lines each contain one string.

\( 0 \leq N \leq 10^5 \); each string contains only printable characters.

outputFormat

Output the list of strings after removing consecutive duplicates. The strings should be printed on a single line separated by a single space.

## sample
7
foo
foo
bar
bar
baz
foo
foo
foo bar baz foo

</p>