#K69272. Longest Identical Subsequence
Longest Identical Subsequence
Longest Identical Subsequence
Given a sequence of characters representing tiles, your task is to find and output the longest contiguous subsequence where all the characters are identical.
For example, if the input is RGBBGRRRRG
, then the longest subsequence of identical characters is RRRR
.
If there are multiple subsequences with the same maximum length, output the one that appears first in the sequence.
The solution should read the input from stdin
and write the result to stdout
.
inputFormat
The input consists of a single line containing a non-empty string s which represents the sequence of tiles.
The string will only contain uppercase English letters.
outputFormat
Output a single line containing the longest contiguous subsequence formed by identical characters.
## sampleRGBBGRRRRG
RRRR