问题1325--Balanced Roxy Substring

1325: Balanced Roxy Substring

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 128 MB

提交

题目描述

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.

样例输入 Copy

rrroyxox

样例输出 Copy

6

提示

Values' range:
0 < the length of the input string <= 106

来源/分类