题目描述
There is a string that only contains 'r', 'o', 'x', and 'y', now you should find the longest substring which has the same amount of 'r' and 'o' and the same amount of 'x' and 'y', and tell me the length of it.
For example, the string "rrroyxox", the substring "rrroyxox" is the qualifying longest substring, because it has 2 'r's and 2 'o's, and 1 'x' and 1 'y'.
输入
A string with only 'r', 'o', 'x', and 'y'.
输出
The length of the qualifying longest substring.
提示
Values' range:
0 < the length of the input string <= 106