题目描述
给一个只包含小写字母且长度不超过100000的字符串,找出每个字母恰好出现两次的最长子串。
输入
第一行是一个正整数T,表示数据组数。每组数据包括一行,包含一个字符串
输出
对每组数据,输出符合要求的最长子串的长度。
样例输入
2
abbccdde
abcedfg
样例输出
6
0
代码:
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <deque>
#include <queue>>
#define MX 50005
using namespace std;
int main() {
int t;
cin>>t;
while(t--) {
string s;
cin>>s;
if(s.size() < 2) {
cout<<0<<endl;
continue;
}
&