#C10866. Categorize Wall Segments
Categorize Wall Segments
Categorize Wall Segments
You are given a string s composed solely of the characters a
, m
, and o
. These characters represent segments of a wall. Your task is to determine the lengths of each consecutive segment of identical characters in the string.
For example, if s is "aaammmmo", then the consecutive segments are: "aaa", "mmmm", and "o", which have lengths 3, 4, and 1 respectively.
Read the input from standard input and print the segment lengths separated by a single space to standard output.
inputFormat
The input consists of a single line containing the string s (where 0 ≤ |s| ≤ 105). Each character in s is one of 'a', 'm', or 'o'.
outputFormat
Output the lengths of consecutive segments of identical characters in the order they appear, separated by a space. If the input string is empty, output nothing.
## sampleaaammmmo
3 4 1