Stream Processing Visualization

This visualization demonstrates how to find the first non-repeating character in a stream of characters. As each character arrives in the stream, we keep track of all characters seen so far and identify the first non-repeating character at each step.

Stream: "abac"

Step 1: Processing character 'a'

a

Characters seen so far:

Character Count
a 1
First non-repeating character: a

Step 2: Processing character 'b'

a
b

Characters seen so far:

Character Count
a 1
b 1
First non-repeating character: a

Since both 'a' and 'b' appear once, the first one ('a') remains the first non-repeating character.

Step 3: Processing character 'a'

a
b
a

Characters seen so far:

Character Count
a 2
b 1
First non-repeating character: b

'a' now appears twice, so it's no longer non-repeating. 'b' becomes the first non-repeating character.

Step 4: Processing character 'c'

a
b
a
c

Characters seen so far:

Character Count
a 2
b 1
c 1
First non-repeating character: b

Now both 'b' and 'c' appear once, but 'b' came first, so it remains the first non-repeating character.

Final Result

a
b
a
c

Characters in final stream:

Character Count Status
a 2 Repeating
b 1 Non-repeating
c 1 Non-repeating
First non-repeating character in "abac": b

After processing the entire stream "abac", the first non-repeating character is 'b'.