Problem A for Train 2
Задачу добавил: elena
Успешно сдано решений: 17
Problem A. Alternating digits
Author: A. Klenin
Input file: input.txt Time limit: 2 sec
Output file: output.txt Memory limit: 64 Mb
Statement
Let us call a string of digits d1 d2 ... dk alternating string if the digits on even and odd positions form two disjoint sets.
For example, 121212 and 01234567 are alternating strings, while 11 and 5435 are not.
Your program must, given the string of digits, find its longest continuous alternating substring. If there is more than one longest substring, output the leftmost one.
Input file format
Input file contains single string of digits.
Output file format
Output file must contain integers P L — position and length of alternating substring.
Constraints
Input string consists of 1 to 30000 digits.
Sample tests
Sample input 1
7777
Sample output 1
1 1
Sample input 2
01234567802345
Sample output 2
2 13