#include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; using namespace std; #define mod 1000003 #define INF 1000000000 #define LLINF 2000000000000000000LL #define SIZE 100 struct RMQ{ int segn2,seg[2<<20]; RMQ(){ segn2=0; } void init(int n){ segn2=1; while(segn20){ k=(k-1)/2; seg[k]=min(seg[k*2+1],seg[k*2+2]); } return; } }; RMQ rmq2; int good[1000010]; int probc[1010]; int main(){ string S; int T,c,n,ans; scanf("%d",&T); for(int i=0;i> S; n = (int)S.size(); for(int i=0;i