**Problem L. Memable Ace **
题意:
给出一个由小写字母构成的字符串(下标从0开始),需求出两个不同的字母相距的最大下标差是多少?
Input
The first line contains an integer T number of test cases where (1≤T≤10).
The only line in each test case is the string S consisting only of lowercase Latin letters where (2≤|S|≤105)
Output
For each test case print the maximum distance between a pair satisfying the above conditions.
知识点:
枚举,贪心
题解:
我们可以创建两个与26个字母对应的数组,用来储存这些字母下标的最大和最小值,之后嵌套遍历这两个数组得到距离的最大值。
代码:
#include <bits/stdc++.h>
using namespace std;
// 创建数组
int mi[27];
int ma[27];
int main () {
int tt;
freopen