1. Given an input stream of N characters consisting only of lower case alphabets. 2. The task is to find the first non repeating character, each time a character is inserted to the stream. 3. If no non repeating element is found print -1.
Input Format
First line contains an integer N denoting the size of the stream. Second line contains N characters which are inserted to the stream.
Output Format
Print the first non repeating elements separated by spaces present in the stream at every instant when a character is added to the stream, if no such element is present print -1.
Constraints
1 <= N <= 100
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
4 a a b c
Output
a -1 b b