You are given an input stream s consisting of lowercase alphabets. As you read characters from the stream one by one, determine which character has appeared only once in the stream up to that point. If multiple characters have appeared only once, identify the first one that appeared. If no such character exists, append # to the result. Your task is to build a string that represents the character status for each point in the stream.
NOTE:
Example 1
Input: s = "abac"
Output: "aabb"
Explanation: At position 0: 'a' is non-repeating. At position 1: 'a' and 'b' are non-repeating, with 'a' appearing first. At position 2: 'b' is now the first non-repeating character as 'a' repeats. At position 3: 'b' remains the first non-repeating character.
Example 2
Input: s = "aabbcc"
Output: "a#b#c#"
Explanation: At second , fourth and sixth position a, b, and c repeats respectively.
Sign in to write, run, and submit your solution against the full test suite.