Last Updated: 1 Sep, 2025

Sequential Character Indexing

Easy

Problem statement

You are given a string S. Your task is to process this string and generate a new string (or sequence of numbers) based on the sequential count of each character's appearance.

The process is as follows:

1) Iterate through the input string from left to right.
2) For each character, determine how many times that specific character has appeared so far in the string.
3) If a character c is encountered for the 1st time, its count is 1. If it's encountered for the 2nd time, its count is 2, and so on.
4) Replace each character in the original string with its sequential count.


Input Format:
The first line of input contains a single string S.


Output Format:
Print a single line containing the space-separated sequence of sequential counts corresponding to each character in the original string.


Note:
The counting is case-sensitive ('a' and 'A' are treated as different characters).

Spaces and other symbols should be counted just like letters.