Add an element to a set

When dealing with lists, it was possible to add an element with .append() method, which would add a new element to the end of the list. When working with sets, it’s important to remember that sets don’t have a particular order, so the word append would not exactly fit its purpose. So, adding an element to a set is done thorough the .add() method.
a = {1, 2}
a.add(5)
a.add(8)
print(a)   # {8, 1, 2, 5}
If we try to add an element with append, Python will tell us that it’s not possible: AttributeError: 'set' object has no attribute 'append'.

Challenge

Given a text, you are asked to write a program that would print the number of unique characters in that text before every position (character ranges span: 1, 1..2, 1..3, 1..4, 1..5, … 1..n).
The input contains a single line.
The program should print the number of unique characters for every position of that line separated by a space.
Input
Output
abcabd
1 2 3 3 3 4
234asd123
1 2 3 4 5 6 7 7 7
To check your solution you need to sign in
Sign in to continue