PinterestOA #1
Longest Contiguous Substring of Single Character (Rightmost)
估计简单可在线判题
You are given a string containing only lowercase English letters. Find the longest substring of contiguous identical characters; if several are tied in length, choose the rightmost one. Output the string formed by concatenating that character with the length of the substring.
输入格式
One line containing the string source, 1≤|source|≤100, consisting only of a-z (source constraint).
输出格式
Output one character followed by the length of the longest contiguous run; on a tie, take the rightmost run.
样例 1
输入:
bbaacaa
输出:
a2
样例 2
输入:
bbbeed
输出:
b3
样例 3
输入:
ccc
输出:
c3