1325: Balanced Roxy Substring

内存限制:128 MB 时间限制:1.000 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:27 通过:8 通过率:29.63%

题目描述

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.

输入样例 复制

rrroyxox

输出样例 复制

6

数据范围与提示

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

分类标签