#C6897. Consecutive Letters Grouping
Consecutive Letters Grouping
Consecutive Letters Grouping
The task is to split a given string of lowercase letters into maximal groups of consecutive letters. In other words, for a given string s
(consisting of characters between 'a' and 'z'), you need to partition it into substrings such that in each group, the characters form a run of consecutive letters in the alphabet. Mathematically, for any two adjacent characters in a valid group c and c', the relation $$c' = c + 1$$ must hold.
If the input string is empty, the program should output nothing.
Note: Groups must be printed in order and separated by a single space.
inputFormat
The input consists of a single line containing a string s
of lowercase letters ('a' to 'z').
outputFormat
Print the groups of consecutive letters separated by a single space. If the string is empty, do not print anything.
## sampleabcdef
abcdef