#K88382. Group Digits
Group Digits
Group Digits
You are given a positive integer n. Your task is to group consecutive identical digits together and output each group as a separate number. For example, if the input is 112233
, then the groups are 11
, 22
, and 33
.
More formally, if n is represented as a sequence of digits, you need to partition the sequence into contiguous groups such that each group contains only identical digits.
For instance, if n is given as a string, the grouping process can be described by the following pseudo-formula:
\(\text{groups} = \{ g_i \mid g_i = d_i d_i \ldots d_i \text{ with } d_i = d_{i+1} = \cdots \}\)
Output the resulting groups separated by a space.
inputFormat
The input consists of a single line containing a positive integer n without any spaces.
outputFormat
Output the grouped digits of the integer, with each group separated by a single space. There should be no trailing spaces in the output.
## sample112233
11 22 33