#K56282. Remove Duplicate Songs from Playlist
Remove Duplicate Songs from Playlist
Remove Duplicate Songs from Playlist
In this problem, you are given a playlist containing song names. Your task is to remove all duplicate songs while preserving the order of their first occurrence. Formally, if the playlist is given as a sequence ( S = (s_1, s_2, \ldots, s_n) ), you must produce a sequence ( T ) such that every element in ( T ) appears in ( S ) only once and in the same order as their first occurrence in ( S ).
The input is read from the standard input (stdin) and the output is printed to the standard output (stdout).
inputFormat
The first line contains an integer ( N ) indicating the number of songs in the playlist. The following ( N ) lines each contain a song name (a non-empty string that may include spaces).
outputFormat
Print each unique song on a new line in the order of their first occurrence.## sample
5
song1
song2
song1
song3
song2
song1
song2
song3
</p>