QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#221687#7618. Pattern Searchucup-team087#AC ✓651ms38168kbC++2011.3kb2023-10-21 14:14:592023-10-21 14:14:59

Judging History

你现在查看的是最新测评结果

  • [2023-10-21 14:14:59]
  • 评测
  • 测评结果:AC
  • 用时:651ms
  • 内存:38168kb
  • [2023-10-21 14:14:59]
  • 提交

answer

#ifndef LOCAL
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#endif

#include <bits/stdc++.h>
using namespace std;

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b;return true;}else return false;}
template<class t,class u> bool chmin(t&a,u b){if(b<a){a=b;return true;}else return false;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

#define mp make_pair
#define mt make_tuple
#define one(x) memset(x,-1,sizeof(x))
#define zero(x) memset(x,0,sizeof(x))
#ifdef LOCAL
void dmpr(ostream&os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ";
	dmpr(os,args...);
}
#define dmp2(...) dmpr(cerr,__LINE__,##__VA_ARGS__)
#else
#define dmp2(...) void(0)
#endif

using uint=unsigned;
using ull=unsigned long long;

template<class t,size_t n>
ostream& operator<<(ostream&os,const array<t,n>&a){
	return os<<vc<t>(all(a));
}

template<int i,class T>
void print_tuple(ostream&,const T&){
}

template<int i,class T,class H,class ...Args>
void print_tuple(ostream&os,const T&t){
	if(i)os<<",";
	os<<get<i>(t);
	print_tuple<i+1,T,Args...>(os,t);
}

template<class ...Args>
ostream& operator<<(ostream&os,const tuple<Args...>&t){
	os<<"{";
	print_tuple<0,tuple<Args...>,Args...>(os,t);
	return os<<"}";
}

ll read(){
	ll i;
	cin>>i;
	return i;
}

vi readvi(int n,int off=0){
	vi v(n);
	rep(i,n)v[i]=read()+off;
	return v;
}

pi readpi(int off=0){
	int a,b;cin>>a>>b;
	return pi(a+off,b+off);
}

template<class t>
void print_single(t x,int suc=1){
	cout<<x;
	if(suc==1)
		cout<<"\n";
	if(suc==2)
		cout<<" ";
}

template<class t,class u>
void print_single(const pair<t,u>&p,int suc=1){
	print_single(p.a,2);
	print_single(p.b,suc);
}

template<class T>
void print_single(const vector<T>&v,int suc=1){
	rep(i,v.size())
		print_single(v[i],i==int(v.size())-1?suc:2);
}

template<class T>
void print_offset(const vector<T>&v,ll off,int suc=1){
	rep(i,v.size())
		print_single(v[i]+off,i==int(v.size())-1?suc:2);
}

template<class T,size_t N>
void print_single(const array<T,N>&v,int suc=1){
	rep(i,N)
		print_single(v[i],i==int(N)-1?suc:2);
}

template<class T>
void print(const T&t){
	print_single(t);
}

template<class T,class ...Args>
void print(const T&t,const Args&...args){
	print_single(t,2);
	print(args...);
}

string readString(){
	string s;
	cin>>s;
	return s;
}

template<class T>
T sq(const T& t){
	return t*t;
}

void YES(bool ex=true){
	cout<<"YES\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void NO(bool ex=true){
	cout<<"NO\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void Yes(bool ex=true){
	cout<<"Yes\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void No(bool ex=true){
	cout<<"No\n";
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
//#define CAPITAL
/*
void yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<"\n";
	#else
	cout<<"Yes"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void no(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<"\n";
	#else
	cout<<"No"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}*/
void possible(bool ex=true){
	#ifdef CAPITAL
	cout<<"POSSIBLE"<<"\n";
	#else
	cout<<"Possible"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}
void impossible(bool ex=true){
	#ifdef CAPITAL
	cout<<"IMPOSSIBLE"<<"\n";
	#else
	cout<<"Impossible"<<"\n";
	#endif
	if(ex)exit(0);
	#ifdef LOCAL
	cout.flush();
	#endif
}

constexpr ll ten(int n){
	return n==0?1:ten(n-1)*10;
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

int topbit(signed t){
	return t==0?-1:31-__builtin_clz(t);
}
int topbit(ll t){
	return t==0?-1:63-__builtin_clzll(t);
}
int topbit(ull t){
	return t==0?-1:63-__builtin_clzll(t);
}
int botbit(signed a){
	return a==0?32:__builtin_ctz(a);
}
int botbit(ll a){
	return a==0?64:__builtin_ctzll(a);
}
int botbit(ull a){
	return a==0?64:__builtin_ctzll(a);
}
int popcount(signed t){
	return __builtin_popcount(t);
}
int popcount(ll t){
	return __builtin_popcountll(t);
}
int popcount(ull t){
	return __builtin_popcountll(t);
}
int bitparity(ll t){
	return __builtin_parityll(t);
}
bool ispow2(int i){
	return i&&(i&-i)==i;
}
ll mask(int i){
	return (ll(1)<<i)-1;
}
ull umask(int i){
	return (ull(1)<<i)-1;
}
ll minp2(ll n){
	if(n<=1)return 1;
	else return ll(1)<<(topbit(n-1)+1);
}

bool inc(int a,int b,int c){
	return a<=b&&b<=c;
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll rand_int(ll l, ll r) { //[l, r]
	//#ifdef LOCAL
	static mt19937_64 gen;
	/*#else
	static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
	#endif*/
	return uniform_int_distribution<ll>(l, r)(gen);
}

ll rand_int(ll k){ //[0,k)
	return rand_int(0,k-1);
}

template<class t>
void myshuffle(vc<t>&a){
	rep(i,si(a))swap(a[i],a[rand_int(0,i)]);
}

template<class t>
int lwb(const vc<t>&v,const t&a){
	return lower_bound(all(v),a)-v.bg;
}
template<class t>
bool bis(const vc<t>&v,const t&a){
	return binary_search(all(v),a);
}

vvc<int> readGraph(int n,int m){
	vvc<int> g(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		//sc.read(a,b);
		a--;b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	return g;
}

vvc<int> readTree(int n){
	return readGraph(n,n-1);
}

template<class t>
vc<t> presum(const vc<t>&a){
	vc<t> s(si(a)+1);
	rep(i,si(a))s[i+1]=s[i]+a[i];
	return s;
}
vc<ll> presum(const vi&a){
	vc<ll> s(si(a)+1);
	rep(i,si(a))s[i+1]=s[i]+a[i];
	return s;
}
//BIT で数列を管理するときに使う (CF850C)
template<class t>
vc<t> predif(vc<t> a){
	gnr(i,1,si(a))a[i]-=a[i-1];
	return a;
}
template<class t>
vvc<ll> imos(const vvc<t>&a){
	int n=si(a),m=si(a[0]);
	vvc<ll> b(n+1,vc<ll>(m+1));
	rep(i,n)rep(j,m)
		b[i+1][j+1]=b[i+1][j]+b[i][j+1]-b[i][j]+a[i][j];
	return b;
}

//verify してないや
void transvvc(int&n,int&m){
	swap(n,m);
}
template<class t,class... Args>
void transvvc(int&n,int&m,vvc<t>&a,Args&...args){
	assert(si(a)==n);
	vvc<t> b(m,vi(n));
	rep(i,n){
		assert(si(a[i])==m);
		rep(j,m)b[j][i]=a[i][j];
	}
	a.swap(b);
	transvvc(n,m,args...);
}
//CF854E
void rotvvc(int&n,int&m){
	swap(n,m);
}
template<class t,class... Args>
void rotvvc(int&n,int&m,vvc<t>&a,Args&...args){
	assert(si(a)==n);
	vvc<t> b(m,vi(n));
	rep(i,n){
		assert(si(a[i])==m);
		rep(j,m)b[m-1-j][i]=a[i][j];
	}
	a.swap(b);
	rotvvc(n,m,args...);
}

//ソートして i 番目が idx[i]
//CF850C
template<class t>
vi sortidx(const vc<t>&a){
	int n=si(a);
	vi idx(n);iota(all(idx),0);
	sort(all(idx),[&](int i,int j){return a[i]<a[j];});
	return idx;
}
//vs[i]=a[idx[i]]
//例えば sortidx で得た idx を使えば単にソート列になって返ってくる
//CF850C
template<class t>
vc<t> a_idx(const vc<t>&a,const vi&idx){
	int n=si(a);
	assert(si(idx)==n);
	vc<t> vs(n);
	rep(i,n)vs[i]=a[idx[i]];
	return vs;
}
//CF850C
vi invperm(const vi&p){
	int n=si(p);
	vi q(n);
	rep(i,n)q[p[i]]=i;
	return q;
}

template<class t,class s=t>
s SUM(const vc<t>&a){
	return accumulate(all(a),s(0));
}

template<class t>
t MAX(const vc<t>&a){
	return *max_element(all(a));
}

template<class t>
pair<t,int> MAXi(const vc<t>&a){
	auto itr=max_element(all(a));
	return mp(*itr,itr-a.bg);
}

template<class t>
t MIN(const vc<t>&a){
	return *min_element(all(a));
}

template<class t>
pair<t,int> MINi(const vc<t>&a){
	auto itr=min_element(all(a));
	return mp(*itr,itr-a.bg);
}

vi vid(int n){
	vi res(n);iota(all(res),0);
	return res;
}

template<class S>
void soin(S&s){
	sort(all(s));
}

template<class S>
S soout(S s){
	soin(s);
	return s;
}

template<class S>
void rein(S&s){
	reverse(all(s));
}

template<class S>
S reout(S s){
	rein(s);
	return s;
}

template<class t,class u>
pair<t,u>&operator+=(pair<t,u>&a,pair<t,u> b){
	a.a+=b.a;a.b+=b.b;return a;}
template<class t,class u>
pair<t,u>&operator-=(pair<t,u>&a,pair<t,u> b){
	a.a-=b.a;a.b-=b.b;return a;}
template<class t,class u>
pair<t,u> operator+(pair<t,u> a,pair<t,u> b){return mp(a.a+b.a,a.b+b.b);}
template<class t,class u>
pair<t,u> operator-(pair<t,u> a,pair<t,u> b){return mp(a.a-b.a,a.b-b.b);}

template<class t>
t gpp(vc<t>&vs){
	assert(si(vs));
	t res=move(vs.back());
	vs.pop_back();
	return res;
}

template<class t>
void pb(vc<t>&a,const vc<t>&b){
	a.insert(a.ed,all(b));
}

template<class t>
vc<t> cat(vc<t> a,const vc<t>&b){
	pb(a,b);
	return a;
}

template<class t,class u>
vc<t>& operator+=(vc<t>&a,u x){
	for(auto&v:a)v+=x;
	return a;
}

template<class t,class u>
vc<t> operator+(vc<t> a,u x){
	return a+=x;
}

template<class t,class u>
vc<t>& operator-=(vc<t>&a,u x){
	for(auto&v:a)v-=x;
	return a;
}

template<class t,class u>
vc<t>& operator-(vc<t> a,u x){
	return a-=x;
}

bool dbg=false;

//f(lw)=true,f(up)=false
template<class F>
int find_max_true(int lw,int up,F f){
	while(up-lw>1){
		const int mid=(lw+up)/2;
		if(f(mid))lw=mid;
		else up=mid;
	}
	return lw;
}

vi getcnt(){
	string s;cin>>s;
	vi num(26);
	for(auto c:s){
		num[c-'a']++;
	}
	return num;
}

void slv(){
	vi x=getcnt();
	vi y=getcnt();
	rep(i,26)if(x[i]<y[i]){
		return print(0);
	}
	rep(i,26)x[i]-=y[i];
	
	int ss=SUM(x);
	int ts=SUM(y);
	vi ks=vid(ts)+1;
	myshuffle(ks);
	
	int ans=0;
	
	vi base(26),candec(26);
	
	for(auto k:ks){
		int p=ts/k;
		
		int atar=ts%k,btar=k-atar;
		int asum=0,bsum=0;
		
		bool bad=false;
		
		rep(i,26){
			int a=y[i]%p;
			int b=(y[i]-a*(p+1))/p;
			if(b<0){
				bad=true;
				break;
			}
			asum+=a;
			bsum+=b;
			
			base[i]=a+b;
			candec[i]=b/(p+1);
		}
		
		if(bad)continue;
		
		if(atar>=asum&&(atar-asum)%p==0
		&& btar<=bsum&&(bsum-btar)%(p+1)==0
		&& (atar-asum)/p==(bsum-btar)/(p+1)){
			int need=(atar-asum)/p;
			if(need>SUM(candec))continue;
			
			auto check=[&](int w){
				assert(w>0);
				int tot=0;
				rep(i,26){
					int c=x[i]/w;
					if(c<base[i]-candec[i])return false;
					tot+=c;
				}
				if(tot<k)return false;
				return true;
			};
			
			if(check(ans+1)){
				ans=find_max_true(ans+1,ss+1,check);
			}
		}
	}
	
	print(ans+1);
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	if(dbg){
		while(1)slv();
	}else{
		int t;cin>>t;rep(_,t)
		slv();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3484kb

input:

2
bajkaaall aal
abca cba

output:

2
1

result:

ok 2 number(s): "2 1"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3460kb

input:

16
a a
a b
b a
aa a
ab aa
ab b
ab c
aaz az
abcde edcba
aaaaaaaaaaaabbb aaaaaaaaabb
aaaaaazz az
aaaaaaaaaz zzzzz
gggggggggggggggggggge ggggeeee
hyphyphyphyphyphyphyphyphyphyphyphyp eeeeeeeeee
hyphyphyphyphyphyphyphyphyphyphyphype eeteeteeteet
aaaabbbbbbcccccccc aaabbbbbcccccc

output:

1
0
0
2
0
1
0
1
1
2
2
0
0
0
0
1

result:

ok 16 numbers

Test #3:

score: 0
Accepted
time: 153ms
memory: 3528kb

input:

90522
cyykzyylklyll ylcyllklzk
ttusuuudtdtqus uuddu
uefyqfkiblyfkyd ffyyqde
qfxqecljeqeedea jqdxf
prrbfxdxffpbpp ffppd
ynjgygygjnjnjg jgynjggn
maenpaksmxyya saxkep
nrdnbnjipnjowjz djbwojzrpni
oputuoufoojupu uoouopo
mphmhphpkpkpmhp phmhpppp
zwznzpzqyjczzy wczjnpzqy
pfxfxxkfffpfx fxffkffxpx
hzdhzhhh h...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
4
1
1
1
2
1
1
4
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
2
3
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
2
1
1
1
1
4
1
2
1
1
1
1
1
3
1
1
3
1
1
1
1
1
1
1
1
1
1
1
3
1
1
4
1
1
1
1
1
1
1
1
1
1
5
1
7
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
...

result:

ok 90522 numbers

Test #4:

score: 0
Accepted
time: 149ms
memory: 3496kb

input:

100000
qpohohoqoyqqtkqoqqqfl qptqyqq
yrirresrslrssrrryysrs srysssy
qqtqqslrrsrlfmqtssrhr rsfsq
jfejsqjyflsqqlyydqdts yqsjj
zrzrezrzzszzrrrrrrrrr rrrrrz
ifqgfqqfttbbhgoqqgiqq iqgbggq
xejojrxlglerjgjljppjv jjjje
whhtowwwwhrhhthttombt hoohh
tqwthgtnstqtwattstwww tsqwwqs
cwurupfwrkckupkckpkzu pkcp
ogonm...

output:

1
2
1
2
3
1
2
1
1
2
1
1
3
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
2
1
2
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
5
1
2
1
1
3
1
1
1
1
1
2
1
1
1
2
1
2
1
1
1
1
1
2
1
1
2
1
2
1
3
2
1
1
2
1
3
2
1
1
1
1
1
3
1
1
1
1
1
2
2
5
1
2
4
1
2
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 132ms
memory: 3492kb

input:

88214
lysxulsgzsxybcgbbcglx zyysssu
kdlrkfhkzkzqqdkqoqkfr loqkkqh
ceaiiaipiipzazizpaaiz ieaicai
jbjzowzcaioauqmbiuzjm wcq
kdnkdddddjcdmndkmjdkd dcdjnj
ywruruwpyuwpwwwzxuxwz xxrwwuu
fapaffifoafopyyaiaaaf ffffoyp
zzzvzaavazvazzzzvvzzv avvvavv
fbtubsuubsufstbdfefet bedue
bylyggblggvgbymybvlvg vmvg
aara...

output:

1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
3
2
2
1
1
1
1
1
2
6
2
1
1
1
1
1
1
1
1
1
1
1
2
6
2
1
1
1
2
1
1
1
3
1
1
1
1
1
1
2
1
2
1
2
1
1
1
4
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
4
1
1
1
2
1
1
2
1
1
1
1
1
1
2
1
1
1
2
1
1
1
2
1
1
2
1
2
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
2
1
7
1
1
2
2
1
1
1
1
1
2
3
5
2
1
1
3
3
1
1
2
1
...

result:

ok 88214 numbers

Test #6:

score: 0
Accepted
time: 123ms
memory: 3460kb

input:

95170
vlrsovvpollyrorrl lrrrly
btcbtenuvbsbapw bcbuse
hlxyhhhbhuxhybxh hlxhx
qgiccigisiiiirci qcc
jxpjjjhjojojhj jhjph
xxwwwewtweeed wt
yxxbqjzjnblzjmn znq
rbmbbbbbbmrblbmb mmlmb
rneccaccrtchnxorc athrrc
kkxkxxkxxkkxxxk xxkxkk
donsxndqd nn
csccvvscvvcvzc ccvs
bkhhkkhkh hhbhhk
mwvmvpmwjjpepvwer ejerj...

output:

1
1
1
1
1
1
1
1
1
5
1
2
1
1
1
2
1
3
2
1
2
1
1
1
1
1
1
4
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
4
1
1
1
2
1
4
4
1
1
1
2
1
1
1
1
1
9
2
2
3
1
1
3
2
1
1
1
1
3
1
1
3
1
2
1
2
1
1
2
1
2
2
1
2
1
1
1
1
1
1
2
3
1
2
1
1
1
1
1
2
2
1
4
1
1
1
1
2
1
1
5
2
1
1
3
1
1
3
1
1
2
2
1
1
1
2
4
1
...

result:

ok 95170 numbers

Test #7:

score: 0
Accepted
time: 118ms
memory: 3504kb

input:

96180
rqkdfgusdfgffjkru jkksq
ddeeeddeuude duue
vuyuluqyqjwyqqjwwj uylvq
srnlpkpoeggywrdpig ppgpg
stqxlqxqsqqlssq lxqlx
sbpsnnfbnppfnsjp nfjsb
bvqmbbgbzkgvkkgqmz qqb
kkkhhlhvhhjhhk hvjl
xxqyxeqfbssyeewex wsf
twmlbtitqltmik mm
ccbczbccbycbceb ccccb
msmjjmpifepj mjsjj
kbmkkbkbkmbkmmkk bbbb
fpgfrpbkrrh...

output:

1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
3
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
3
3
1
1
1
3
1
1
2
1
1
1
2
3
1
2
1
1
1
2
1
2
2
4
1
2
1
2
1
1
5
2
2
1
1
1
1
1
4
4
1
1
1
3
2
1
3
1
1
1
1
1
1
1
3
1
1
2
5
1
1
1
1
2
1
1
1
2
1
1
2
1
2
1
1
2
10
2
1
1
1
1
3
2
1
1
2
2
1
1
8
1
1
2
1
1
1...

result:

ok 96180 numbers

Test #8:

score: 0
Accepted
time: 93ms
memory: 3440kb

input:

84351
bkiiiekpipghhkhhpia abgh
vchhuubuhbnhzxdg huuh
yyeoyeereybieerry ryr
ttzwzwtzzzcwztww t
xoxokixkkkck xxoo
lcrzzlbcuzgggakldzg blll
lohwlllrolrlkllwln nlkh
zosszzookkongnkpnn nkgp
zzqqqqqzzqqqqrzrzqq zzq
pqupfefpqwezuzppbq q
kxoxhughuuuuugk huuu
gkbsnwnnnupsnsnrjzs nk
mbvmxttddwdvzv vxdm
xnptax...

output:

1
2
2
4
1
1
1
1
5
3
2
1
1
3
2
1
1
2
1
1
1
1
2
1
1
5
3
2
1
2
1
1
4
1
1
1
1
1
1
1
3
1
2
1
3
1
7
1
4
2
1
1
1
1
1
2
2
6
1
9
1
2
3
1
1
1
1
1
2
2
1
1
1
1
2
4
1
10
2
3
1
2
2
3
8
1
1
3
1
1
5
4
3
1
1
2
1
2
2
1
8
1
3
1
1
3
7
1
2
1
1
1
2
1
1
2
2
1
2
1
1
1
7
1
5
2
2
1
1
1
3
3
1
1
2
1
1
2
2
1
1
1
1
1
4
2
2
1
3
7...

result:

ok 84351 numbers

Test #9:

score: 0
Accepted
time: 103ms
memory: 3452kb

input:

99795
qimqpqdqnmmqprdfqpqqe imp
ttzswwzwzszjjzwjzzoowo wto
zzwwzzwwwqgppzpwpizq zwp
juaiaiiiiaaajijiiaqrti jra
ynydxdnyyxyyxxtdyyrby ydy
ggweegjowgspqvbpkwcw pbp
rgrrrreimvvggrardrr eri
gonotggooogovbnodocw nt
hmqkkqzmzrkzmmztk tzh
hqjghjhjjhdgdjhhhgnnh hj
szfjjqjbsbjjsjzjjss zsz
ntmeiimiimpibujiiix...

output:

1
2
4
1
3
1
1
1
1
5
1
3
1
1
1
2
2
7
3
1
1
2
1
4
2
1
9
1
2
5
2
4
1
6
1
2
7
7
4
2
4
4
6
5
2
1
1
1
3
4
2
2
1
1
2
1
3
1
1
1
1
3
1
21
1
1
1
1
2
4
1
3
1
2
2
1
3
1
2
1
2
2
4
4
8
4
1
2
2
1
3
10
3
3
7
1
1
3
1
2
1
2
1
1
1
1
1
5
2
1
2
2
3
3
5
1
2
1
1
1
1
1
1
2
4
2
5
2
1
1
2
1
4
11
1
1
4
2
2
9
7
2
1
1
1
1
2
3
1...

result:

ok 99795 numbers

Test #10:

score: 0
Accepted
time: 60ms
memory: 3456kb

input:

97112
nnnhnoogzhzho zgonzngnonn
znzyzanuaaaaa aznanaazyzzna
wrwwtvwwwwww rwtv
xjfdojyjvvaaa dvvxfovvjy
ymqyyymiiyyyy mmqyyyqq
qbbppuqqccpbq qcbuccqpcu
trrsttrstsv vvsrrs
yedyedyyddedx yxxddyyxxyx
alvxdgdguydal uxyddv
gfgggxgigi ggggggi
yffjyfjfijyf jijiiiiif
ctccttce ee
qqxqdxdedquud qeedeeeee
gzgqy...

output:

0
0
1
0
0
0
0
0
1
1
0
0
0
1
0
0
0
1
1
4
0
0
7
0
0
0
1
0
0
0
0
1
0
0
1
0
2
0
1
4
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
1
0
3
0
0
1
0
1
0
0
0
0
1
0
3
0
0
0
0
1
1
1
0
3
0
0
1
0
0
1
0
0
0
0
0
2
0
0
0
0
0
0
5
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
4
0
0
0
...

result:

ok 97112 numbers

Test #11:

score: 0
Accepted
time: 200ms
memory: 3556kb

input:

83674
ssspsssspssssspsssssspsssssssssssspsssssssss sspssssspss
gggiigggiiiigggggiiigiigggggiiiigii gggigggiggg
djjjjjjjjdjdjjdjjddjjjjjjjjjjdjjjdjjjjdj ddjdd
ttttttttttttttttttttttttttttttttttttttttttttttttttd dddddddddd
aaaaaaaaaaaaaawaaaaaaaaaaaaaawaaaaaaaaawaaaaaaa wwwwwawwwww
ppeppeppepppeeppepp...

output:

4
4
3
0
0
4
10
0
0
6
5
1
1
9
0
12
8
4
16
0
0
21
7
3
2
5
0
7
8
13
37
9
6
3
0
0
0
1
14
4
0
2
5
1
0
0
5
9
38
4
0
0
0
0
0
3
4
5
1
0
4
3
2
32
0
2
7
5
0
1
0
8
1
0
0
14
28
0
0
0
14
7
7
0
2
14
0
0
1
1
7
0
5
7
0
1
3
10
4
0
2
0
6
1
1
4
1
7
2
1
0
0
1
8
3
11
3
10
2
10
5
42
1
0
2
14
4
0
6
3
2
1
5
1
1
3
3
0
10
7
...

result:

ok 83674 numbers

Test #12:

score: 0
Accepted
time: 224ms
memory: 3492kb

input:

62490
zzzzzzezzzzezezzzzzzzzezzzzzezzzzzzzzzzzzeezzzezzz zzzzzzzz
hhhhhhhhhhhhhvhhhhvhhhhhhhhhhhhhhhhhvhhhhhvhvhhhhhvhhhhh hvhhhhhvhhvhhhh
qqqqqqqqqqqqqffqqqqfqqqqqqqqqqfqqqfqqqqqqqfqfffqfqfqqqqfq fffffffffqfqffq
aaaaaaaaxaaaxaxxxaxaaxaxxxaxaaaxaxaaxaaaxaaaaaaxaaaax aaxxxxxxaxxxxaxx
wwwjwwwwwwwwwwww...

output:

35
4
1
2
41
7
30
35
17
1
1
9
21
8
40
6
5
26
8
2
3
16
25
9
10
28
5
10
9
27
19
20
1
10
43
3
20
25
4
3
34
20
16
1
7
4
12
5
2
8
1
2
2
7
4
3
20
12
3
22
5
5
2
20
7
5
18
8
13
8
9
20
11
4
1
21
16
46
47
8
8
10
11
3
3
5
8
9
10
8
11
15
8
7
3
36
17
6
10
8
13
11
34
5
11
9
10
10
1
2
10
18
11
2
8
13
9
12
24
19
13
...

result:

ok 62490 numbers

Test #13:

score: 0
Accepted
time: 75ms
memory: 3468kb

input:

16387
mmmmmmmmuummmmmmmummmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmummmmmmummmummmmmmmmmummummmmmmmmummmmmummmmmummmummummummmummmmmuumumummummmmmummmummmmmmmmmummmmmmmmmmmumuuumummmmmmmmmmmmmmmmmumumummmmmmmummmmmmmmmmmummmummmmmmmmmmmmmmummmmmmumu ummuuuuuuum
thhhhhthhhtthhthhhhthhhhthhthhhttthhhhthhhhhhthh...

output:

15
52
37
60
11
109
64
25
21
14
59
36
73
65
8
47
27
10
50
36
25
38
9
56
62
43
30
31
35
139
58
17
28
59
92
9
62
15
82
71
97
94
16
23
1
8
61
159
38
8
103
88
32
18
18
18
55
24
43
4
35
17
30
36
35
138
7
12
17
41
99
13
59
2
67
139
3
201
22
34
41
81
109
13
15
28
42
12
28
42
10
31
53
91
45
23
32
36
31
36
32...

result:

ok 16387 numbers

Test #14:

score: 0
Accepted
time: 192ms
memory: 3504kb

input:

95000
ffctccfffcfft cffftft
nnuuuunuunnuuuuaunuuuuuuuuuu nununnuu
aaaaaaiiaiaaaaaaiaaaaaaaiaaagaiaa aia
sggsggsgssyssgsgsyggysgggss ygsygg
kkkkkkxrxkkkkkkkkkkkkkkkkxkkkkkrk krxxkkkrk
ykhhhyhhyhhhhkyyyhhykhhyyhhky khhyy
fffnnnfffkfnknknf nffffnkn
glllllllllllllllllllelllllllelllll ee
eieieieeeeeeiiee...

output:

1
3
6
2
1
4
2
1
1
1
4
1
1
1
3
1
1
12
10
2
1
3
4
1
1
1
3
1
2
1
1
1
1
9
13
3
1
2
1
3
1
1
1
2
3
3
9
3
1
23
2
1
2
1
4
12
1
6
1
2
9
1
3
7
1
2
1
3
1
2
8
1
2
13
2
6
1
1
2
2
1
2
1
1
1
6
2
1
5
1
7
5
7
12
17
2
1
2
1
14
7
3
8
3
1
1
5
1
2
2
1
1
5
1
3
4
1
11
5
1
1
4
7
16
1
1
1
1
2
5
1
3
2
2
1
9
1
1
6
5
1
1
3
1
7...

result:

ok 95000 numbers

Test #15:

score: 0
Accepted
time: 210ms
memory: 3456kb

input:

92634
qhchcqchhchqhqhhchhhhqqhhhq qqqqqqq
mmlppmplpmmpllllmmpp lllll
qqngnqgnngqqgnqqqgnnqqnqn qqnqnnnqq
tjtjjggttjtjjttjjjjjggtjg ggtjjj
ollllloolllllollloolollololllloll lloollloo
fxffxfflflfxfflxlffxxlx xlxxxxxxf
rrnnrrrruunuurrnurnunrrnrnrrrn nnrrnrnn
usssussuuuussussssusuusuuuus usuusususs
qccq...

output:

1
2
6
4
7
1
3
10
1
3
1
6
6
2
4
18
10
3
4
2
2
6
1
4
1
4
1
2
4
1
1
5
1
1
3
5
1
5
2
2
1
3
4
3
5
1
4
2
32
8
3
6
2
4
8
1
1
1
3
2
1
1
4
2
1
1
2
1
3
6
13
1
2
3
3
1
2
5
5
1
1
8
4
11
1
2
6
3
4
1
5
6
1
15
4
5
7
3
6
4
3
2
3
3
1
1
1
1
2
7
4
1
2
1
3
4
6
2
5
1
4
1
8
1
2
1
2
4
13
5
1
4
22
1
2
12
2
2
3
2
1
1
3
2
4
...

result:

ok 92634 numbers

Test #16:

score: 0
Accepted
time: 166ms
memory: 3464kb

input:

92852
xxxxxxxvxvvxxxxxvvxxexxxxxvvxxxxexxvx xxxxxxxxxvv
rhhllrhlhhhhhrhrlrrhhrrhhhllrhhhll hhrhlhhhhhh
hplphppphhphphpphhpphhhhhhhhphhpp phhhphhphph
jjjjjjjjjsjjjjsjysjsjj sjsssjsjjss
bbbgbxxggxgbgxbbgggxxgg xxbxxbxxxxb
svsvvvvvvsgvvvvsvvvvsvsvsvvsvsv gsggggggggg
gggklkkggkgllglgklkkkkglkgklkkkgkgg ...

output:

7
2
6
0
0
0
3
1
0
1
0
0
0
2
0
2
0
0
0
0
0
0
4
2
1
2
2
0
3
3
2
0
0
2
7
0
0
0
0
6
3
0
0
0
0
0
2
0
5
1
0
0
0
2
0
0
3
0
0
4
0
3
1
1
1
1
0
0
1
1
2
1
0
1
6
0
1
4
3
1
0
1
1
0
3
0
0
4
1
3
1
0
0
0
1
2
1
1
0
1
6
0
2
1
4
2
0
0
2
0
0
1
0
2
0
3
1
0
2
0
0
0
0
7
2
3
1
1
1
1
3
2
0
0
3
1
0
0
5
2
3
1
0
1
2
0
0
0
0
2
...

result:

ok 92852 numbers

Test #17:

score: 0
Accepted
time: 217ms
memory: 3460kb

input:

18912
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...

output:

77
67
17
266
114
216
247
57
82
264
103
247
276
36
93
244
100
243
30
139
244
282
68
14
101
256
12
65
5
216
152
234
182
5
271
197
327
200
65
45
166
271
141
167
169
208
70
135
139
143
15
99
194
146
12
75
169
282
179
255
47
39
254
161
246
22
34
59
37
178
140
122
324
65
46
138
65
220
51
119
258
272
26
19...

result:

ok 18912 numbers

Test #18:

score: 0
Accepted
time: 340ms
memory: 3440kb

input:

93950
jtjatjtjtatjjjajatjtj jatattjjjtaajttjj
xxxxgcxgxggxggccx xxccxxcxgxx
nttptptnpptnnppnnpnnptpntt nnpppnnnppnpnnn
kyhhkkkkhkyhkykyhhkkkykyhky kkkkkkkhyykkhhky
nmmmmmnmnnmmmmmmmmmmmmm mmmmmmnmmnmmmm
vvcvkvkkckkvcvvccvvvcv ckvvkckkccc
jffjnjfjfnjjnjnnfjjnjjjf jjjjnnjjnjnjnj
dtdwdtttdtdtdtdttddd d...

output:

1
1
1
2
2
1
2
1
1
1
1
3
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
3
1
1
1
1
1
1
2
2
1
1
1
1
2
1
5
1
1
3
2
1
1
1
1
2
3
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
2
2
1
1
3
1
2
1
1
3
2
1
1
2
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
2
1
1
1
1
...

result:

ok 93950 numbers

Test #19:

score: 0
Accepted
time: 296ms
memory: 3440kb

input:

97146
rrvrqqrrvqrveervrvrevr qeevvvvrvqqv
ffqpqpfppfqpppfpkppp kppppppqpppppf
iifmfmmfnmffmfffmffnmf minmmfmfmmf
beenaeeeebeeeeeeneeae ebeeeaeeeeebaeee
eeseskksekskksksesesks sseekkeksskssssk
kkkmmkekevveevvvkvvkvk kkkvkkevkkvvkv
nnnnnnhhnjhfjnnnnhhnhn nnnnnnnnnnjjnnh
vnaqaaaaannnnvanvaqan aavaavava...

output:

1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
7
1
2
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
3
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
5
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 97146 numbers

Test #20:

score: 0
Accepted
time: 509ms
memory: 38016kb

input:

1
bsjgcfpiktklxlxlfqkwqluatehtlphewnurduntychudptiocmecijoirykdomylbxakttepugeilrftyfhiljfbnasluzwoyntlhaerrlkhhhayzswixqqtvxhusqdxeyujaqcgfqjcjttuppajzatxskluixtmbyuiosymyquelrzpnyspcqpuejmwtqwfdszucwpvlenvjqmzmeaebmzgdqxybmzazfkrtopyxfosjwaonzsofecfcimnrijfxxaeathrxsoauyqcbiqafmhkqrnrjtxblbliwhwvq...

output:

1

result:

ok 1 number(s): "1"

Test #21:

score: 0
Accepted
time: 651ms
memory: 38108kb

input:

1
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

1

result:

ok 1 number(s): "1"

Test #22:

score: 0
Accepted
time: 255ms
memory: 21560kb

input:

1
hxxfiwatcuhxnyklydflhvnzxwdgdypkkkqlzkjjzvcgvpeiqftqyvyhqjgkpvpujbbqnoupkpabfmsmfmmpdfsdzomlvpiejqgespwsromrzderhwtblwslycqoqgkovcwikwqgginfvqpbxradluhmfypvmzirbfwttpadqdbvwvvkbnbdahzjhyiwwklcqekppvlhwfpxpokvmubmknvcwsqektnqvguqzzteccsevyauowmmlkcvgjycbwadhqfuhtcywrpshlvemaeerjftbnsodudxsvbljyxnuo...

output:

201

result:

ok 1 number(s): "201"

Test #23:

score: 0
Accepted
time: 354ms
memory: 28700kb

input:

1
csozmbzomyyzdvvmfiwqjzxuixtniespsnmybsvsxqfcscwmxskcozwwzuwczyzsuwxismszismswsveqczcsozsnvnzqpszzszmyvemwmfwqmksuzxestsusfuumsmmnmsyccusinzfbwsysvzcmnzcmrmxgibzxiewsmnzmwsmewsejswzqzuekrvuzmcwsouesstguysuukuwwuviywxmtmlsnuswimmwknygcsxzymcsszsufefzzwgiwusguxzzswxcsciznzsiomxzwzokmmusosczxoccuniimf...

output:

35

result:

ok 1 number(s): "35"

Test #24:

score: 0
Accepted
time: 99ms
memory: 10172kb

input:

1
wmikwxmwsoasiqxigsgusfhszunrxmkwlcdgdxzwcgbnlllasgwsedwxkztlowfztntlvgfdjvzdjwxphvgdblskunnkqlmujzlilqiltxcyybxdfciziyfbpgiksqrneimykxncljjhkweuqznfrkyrltffggbmxbdhqkxndnizqfycugfoskgbayznludvdatzsdltxayqimlowcfqzelskademprtljdfdjcdyurmvltzvpkxuzddlcnjbsptdnzleasijkqqrrjgtyntwunzdiaiigwcqswhalqxdd...

output:

15

result:

ok 1 number(s): "15"

Test #25:

score: 0
Accepted
time: 161ms
memory: 16548kb

input:

1
ppppphpnrphpnpmppmpppnppdmmmpppppnmmpprmdmpppmnnpmfmwmpppdrphprhwmppmppppnmnmmpppmpnppnpppdwmkppptppnmmmppnmppppppnmppodnpnmppmpmmmpnpmmpvpmnpmpnpmpppppnmmwvnnmpdmppppmmnpvppndpmhpknhndnpdptpndnppppvphmpproppmhppppmpppnkprdpnnpmhpppdmrpmpmnpppppmppopptnpppppnnmponppppppdphvnpppmnprpmmpmdptpprnpmpm...

output:

1

result:

ok 1 number(s): "1"

Test #26:

score: 0
Accepted
time: 163ms
memory: 15148kb

input:

1
nwdvjpruhrgysbxjkjhdehebtuwjyksphydmzcfzvckugojwgklceyifgevybwnsunbakiwqxieztmtoatjkjvxniqfhpogytgmlejvhpuydtabpsmtdxaesquhwxuiwjceuzwmwilqfsokjoobbegrpojssaqeojdejjgdjwurortoiqqrscwfaqjotzcchiisjnqcphjppttivlidpfmpulwsvcxrdjgzhuqxjncjlharowhxqnmqopqzldpgicamlgqjdxutxkuavaqhxksfxicmvdnpillucyeptoy...

output:

319

result:

ok 1 number(s): "319"

Test #27:

score: 0
Accepted
time: 475ms
memory: 36548kb

input:

1
dlenbdsjmzzslmaqpqkggzpjuxkkltswnzgaaixgfiriuukfblqnmhqdiviugzdiryxplyfitzjbavhpsemhpdpgnpetfyldtlmgpgzdwdothoczjnksqjtedtvxndvfdttkefptrychboyzvczxdneueaipmnpqbwmxcgowkkdhykxlsqrczruqdvmfhdmvvsssymyyuuwlsjmkgrbnvikrosflptsnyadlkcczhxydrdtdxyytyqzpgojjprcrhuysiwailzagjxztaxqpgjxkidyngwdcpouhezjbvv...

output:

12

result:

ok 1 number(s): "12"

Test #28:

score: 0
Accepted
time: 9ms
memory: 10208kb

input:

1
stmzbeafwzvavtvumqopjdsewpsqdvhcokdjevlzklvqxljzslxqoxxhsqvdiplhjkzklpaguytuiqastdmxojppzuunsyvzvvyfxckhvkwzewhsrnbuoflagyjbnnqqqabpcecgnaydauunmaxpkchaeqsuxhyiztdyxcljyujxhdkobdgibvlnqcmkyzuujovxqphiguggnvxhmrldcbnvdnxkjxdnimnptmirqipajvvxxymaosvnczfohuglbzqnlufgwrifyebczlgvemypbucibeovuyqxwxonmm...

output:

0

result:

ok 1 number(s): "0"

Test #29:

score: 0
Accepted
time: 250ms
memory: 3548kb

input:

2000
ewpuhshjepfwsvxorkneeollbfrvwlgedfamwnqqhizlqjjsotjeoljcykllyhkjugogjgqqqbteisersjwgkwrewsmsubinkydvwgbrgaunjbxiwtofmknolgbkxzianfpczceayrlyyonnowhqdgvswslkqqwoyvhtfyblvchyyfttfbuodzkqquluwgwkhvrgjdrzcllsqjceohvdonhojkmiwnqogyznjqlxuvohwxindtwsiaeovyadukmyzvpohdsbdllzmchiyapsztbhhaazccapyxtnffo...

output:

0
1
1
0
1
0
1
1
0
1
1
0
1
1
0
1
2
1
1
1
1
1
0
2
0
1
1
1
1
1
1
2
1
1
0
1
1
1
1
1
1
1
1
1
2
1
1
0
1
1
0
1
1
1
1
1
1
1
1
0
0
1
2
0
1
0
1
1
1
1
2
0
1
1
1
1
1
2
1
0
1
2
0
0
2
0
1
2
0
2
1
2
1
1
1
1
0
1
2
1
1
1
0
2
0
1
2
2
0
0
0
1
1
2
1
0
1
1
1
2
1
1
2
1
1
2
1
1
0
0
0
2
1
1
1
1
1
1
1
2
2
1
1
0
0
0
0
1
0
0
...

result:

ok 2000 numbers

Test #30:

score: 0
Accepted
time: 278ms
memory: 3576kb

input:

200
ckkuibmjprqcvjyzogypzerpgrnvfonhknyuwqfsqrkobscjugblsrinyabdvtlufcexservhwwvwhimcouaydmvytgliaesgrcxptnthengufeagnfpagjjzvesckpzhjwdfgvoswfgadnhkybsbljmjbivvwofmqqpriucmtqtvxhdeczqoikxpkqzdnqogjgnglodixwoctddkhqjvbivarebfzeiewwliwynpyvkdkexjoiboojfdbuvvtlcererhexlycnurgzsrllbopnnqsgkggflxqrggzjg...

output:

16
17
15
15
16
17
15
15
19
17
15
15
17
15
15
18
17
15
15
16
15
14
18
13
16
16
17
18
18
16
15
16
15
17
14
15
15
13
15
15
16
14
13
17
14
14
17
16
17
17
16
15
15
18
16
17
15
16
16
15
17
16
14
16
15
17
15
14
15
13
17
17
17
15
15
15
15
13
17
15
16
17
18
18
15
17
16
13
15
16
16
17
17
19
16
14
16
14
13
17
...

result:

ok 200 numbers

Test #31:

score: 0
Accepted
time: 363ms
memory: 4188kb

input:

25
sjegbncuyvchkqxmzmgioxvuebhxdnkhroreaiajrrlhfguyqoomlrjmpadcwuefyymnlutdxpuliujluooewjwyzjeaggkhsetzyojpzleyijuxtogjmqpjjpupxlthzutbtcbsvotxlmwpvnylovhbaolcjefplxbjwtrxgpdluljdzixibgteehyouaqvsvakxacbttplvozkbepzwujulfjvqdetdrzeqvsmmfhlhvvnecpozxckvhchgyharhmfhjpflylszhjrdemoaeuqzdadmrdtxkkzlxmci...

output:

29
30
29
32
26
28
30
31
29
29
29
30
31
30
27
30
27
29
29
29
30
29
27
30
29

result:

ok 25 numbers

Test #32:

score: 0
Accepted
time: 383ms
memory: 4996kb

input:

16
lsqppylqlmqvqyyosolboyqlfqlvsqhqucvqqoqcsyxzzczdayyayzqzusovyoxooqgoyzhnyqlywvdhylyonqufzashooqofqfydpzbhoyvsvfquyrswmfqqsxyoyxsqtozphlofbbfswbjhsalqysqsqeqyeolvdhzqaataybaxqhshvvlqqcbovsavhdqhlyvlklsacqaomvsbnhpqpnoaqoyayovvthqbwwcqnfmobayycbqybfsfsoaqqchqqzsvsoqcyqvoavoaosvboqyzstzlqxvqwbbyyvlv...

output:

11
12
5
9
8
9
13
9
6
12
9
4
9
7
10
11

result:

ok 16 numbers

Test #33:

score: 0
Accepted
time: 217ms
memory: 21484kb

input:

1
poojkzobzozbbkpkhjkebwkbbwwbzuuzoobubnoikbkuzokzbuwunbkbgubjjuwwwkwbbbkbezbuzguwozokzubkobbbwwwwbgkkwcbufzbjowjkzwkkbupjepubbzkwiwoobokpokjekwkkbnmobzuwuzugzebkkguojbbbuupwuekwwuxpzwknohuxzkpwokzbzijokuwkzobwwzbwokfobpifpbwwfukkzbuoobngwfunxkwnozkowwozzonhoukipjzfowuwpubkjzkjzznfaiwkuehbbujwhpzpwz...

output:

9

result:

ok 1 number(s): "9"

Test #34:

score: 0
Accepted
time: 241ms
memory: 20768kb

input:

1
bxcxmgmcycxxcggxczhxbmzhcgcxczzmzjmcxoccbhmgbhcxbcfbmcrmcroazzjmzjgxcmxfcgbfbfxmzzaomvobjxcamzxbbobhmamgxbvzmmbbjgfbzxxgcazgrccbgcgrzmfzzzrmzbhbomghcxbmbgzghgmbhjzxmbbjndgbvzzbfxbxzbmzmcmmzrbcrmbhjcbrhbcrxmmmzbrzmxmhxbggzmmmhhvhzcbbrbcggzzizbobzzffjcrxbggighhfcgrkbibmbhgmgfrhzhrczbhxmhbcofmmamfmmr...

output:

38

result:

ok 1 number(s): "38"

Test #35:

score: 0
Accepted
time: 290ms
memory: 23848kb

input:

1
dlmxdlwlvxwonlhkyawvmpxvxamhqmvxxvpulnqtapkfuqcxlwsuulmtxxnplqkfxkuxvftmuxtmnmwmlmmvolwmpnxplmoqqpgzgvmwvlmamkxvxpftutwvpwnnxxotxqvptgxltmlmuxhqkpwvggxmqltvvvuxfqxvvlpnmumlmmeumvxxwexnlllufpxllowulcxqukxwpxlnuawllxfttumxzmvxvqamxlvdqntlyvktowlpvllpnwmqxlwyuwlqukfwuxpxkxnmvvwvmxptwsxnpkxexqtyfxaxnw...

output:

76

result:

ok 1 number(s): "76"

Test #36:

score: 0
Accepted
time: 328ms
memory: 27020kb

input:

1
bfzbwjiqajspnjjiwpbpspsjpbhjbsswjwuwjkujpjjbfogsbjbjcejpwjsuaspjsbfwjwbsjpsbjnossijjcjnjbmbsjetkapajjbshjwiwblbnbajjfulkccuqqacbcjccpjjbjqnwvvpbbkuiinewzjwfijpjjqnpjnbnfnnnbvpbjpujosbbqsjpbcsbwbcjwbbmnpihushjumspjspjsuwhbjbqijvcbwcplwpjqnljsjpqhpbbpwputqjkjujsccvsbbwhjjbwbbbbjpjzbjjbpjnjhnshowpbwp...

output:

172

result:

ok 1 number(s): "172"

Test #37:

score: 0
Accepted
time: 341ms
memory: 25240kb

input:

1
yfeybtbbviubfybjkfcffibbulrblxvfbezfbufyejiumufbfzlkabfufrfxflafhfiuiydtzuhliflrflflzyabfafbaffbujvfuyazahukhvbnsubzcmfbbfauyyuummbfapacfffiufmfcfbfrkuzmuugrmgbuvducccuzyfhcbbbfuuuiaylzrzffhcfffrsfuuuuuauzubyawfvlfaxygfcbuulvabcazvxvuuubuyufffudaffdadbbffafruvbufauvuffabhawlulaydwbuzzufyuwpbcfcflf...

output:

393

result:

ok 1 number(s): "393"

Test #38:

score: 0
Accepted
time: 311ms
memory: 26008kb

input:

1
hpbcfnfivpmpdhppaxpdaipzfvzbfufvyypfzuhxdvfpdfvfpfvcvfpgfkeigpcoxfxdfpffglazpjygujrjwzpifraspgvhfjxhpunpvxmvvetaqppbvalijtkpupzhvnzrjzcfdasgpffubhidncfvzvpfyjdhagptopfpidjvknppxhyffzvpfufdzfyhfhppdefxuhofwfxfvbosftzfdafpnvvikbfvfqrffgyfiappahffvhrfannxztrvfppnjbfgvfgfplvvpejdpyfqcbqgwaacfzzihvhwhe...

output:

1814

result:

ok 1 number(s): "1814"

Test #39:

score: 0
Accepted
time: 357ms
memory: 28668kb

input:

1
ycxjnjztpcvgehtcwzbccwqcwrcfvxtyotppqxkqowcucbwwrfqacjvcjbicdcrbrjviitqbotcuihzplbutvmcctctwlccjgqbpuyhprcscrwxzhkcwnwiaqqbprdmcckrccitpsapcymrcrydkrtixummqcitceqyicsrcuyrphftcisctblzdlbrtrytlcxtpccicjqimttcdqiptqcpebhmteebcipecrcalutsuigycsgszyotvtcazjszmmincycgtqcynceiccqtqcectqpczsjcchxzjtsaqro...

output:

3303

result:

ok 1 number(s): "3303"

Test #40:

score: 0
Accepted
time: 273ms
memory: 22884kb

input:

1
yyyxatwkwppwkylwtwgwqfufixqvgptqhteqbybpquwncakktgklppbdhvhkvgtgktbhpjdqyzixgwmfqqypqigooxpeojgtzdtbocfpdblguaxtpnwxkawsyfgplpkrygyszhwgsxjuniuufbssyyiqwocgtpefvgtkbpojttjxthiqwydfqpkxnrlacwoyqrqsvtpwyrfpbbjqszpwtxgfydoaajuytpzdauwysytttgocvtjgnysbxcbgtwwcyvyqwrxllwwzbtqbzdbjqwtcqlgbyykjgbwrqfngik...

output:

21979

result:

ok 1 number(s): "21979"

Test #41:

score: 0
Accepted
time: 279ms
memory: 23656kb

input:

1
fvolrrxzflnjzlrrepwpppxuwniefmmlvtfrfjfnogxybnpucutpzpfrrxxfsnppxfhspqpjoxruygszwzddarmuewcwuaddgolwsggsagufwpbrffemwrzctryklxrdkmfsxfzfopxteepsnzzpmjpwwmppmpjajnfggbpxxxrrfpdbsmxqyxlrrfxzecsshfbpfnutxmtgwxpnxgoamnqpwtybigrhxyoxnazdrxsskpdppewcgrzrsmrjwdunjmtgxppxpdjcvtrrnpnjbfdfxgzvtdiirvgplxrqkp...

output:

19814

result:

ok 1 number(s): "19814"

Test #42:

score: 0
Accepted
time: 374ms
memory: 28944kb

input:

1
qqqdddddqwdddddjdddjqdqwddqddjdjjdwqddddddddjdqjjdwqddqqjdqdddqwjwwdjwddqdwwdqqdwjddjdddqjddwddqwwjqdwwqqdqjqjqwjjdqjwqwddjdjjddjjwjwdqdwjddjwdqddwjjdqdddqdjjdjddwwjdwdjqjjddqdqdqwjddddjqddqqddjqwddqwdddqqqwdddqwwdwqjdddddqqdjwdqdwdddwqdqwjqqdwwqdqdddwdwwddqqdjdwdjdddwjwdqwqdwdwdddwqwwwqdddwjdddjd...

output:

55556

result:

ok 1 number(s): "55556"

Test #43:

score: 0
Accepted
time: 441ms
memory: 30492kb

input:

1
pmpmppppmpmppmpppppppmppmppmpmppmmmmpmmpmpmpmmppmmpppppppmmppmpppmmmpmppppppppppmpmpmmmpmpmpmppppmmpmppmmmppppppppppmpppmmpppppmpmppmpmpppppmmpppmmpmmppmmmmppmppmpppmpmpmmmmpppppppppppmpmpmpppmppppmmpppppppmpppppppppppppmpmpppmpppppppmmmppppmpppmppppmppmmpppppmppppmpmppppmpppmpppmmpppppppmpmpmmpmm...

output:

154322

result:

ok 1 number(s): "154322"

Test #44:

score: 0
Accepted
time: 260ms
memory: 19716kb

input:

1
qididdjqfjfjifufujiqiujquiujufuqjuiidiufudqjiiiiujquiiiqijquuquufiiiufqujiqquuufuiquiiiuujfuuuiuufiiuiuduqjiiuffjqfjiffiuuidfqjuiufuijiuufqqjujjififqddufidiqiqfidffduifidiqjufudjffifuifiquiuifiuuuiiufuuufjdududiifjffjuuiuufuiuuqiiuijuuuiiuiiduuuuiqjiiififijjjijiuuiuiqufuqduqufjqufiijiifffujiidjjjq...

output:

6794

result:

ok 1 number(s): "6794"

Test #45:

score: 0
Accepted
time: 295ms
memory: 24784kb

input:

1
vqvdvqvdqqbffcqcvvbqvqbqbcvqqvqfvfqdcqdqvqqqqqvvqbccbbqqqbbbvbbbqqcdccvccvqcvqvdbvvdbfqqbbcvqqvfdqbbvvqbcbvvvdvfvdbqfqvcvccdqbfbfvvbvcqvbddbcvfqfbbfvbbbbdbqcbvbvbvvdqbcvvvvbvcvfbfvbccqqbqvvdvvbvbqdvvcfqcdccqcvdqqbvvbfbqvbddvbvbvcbvvqvqvqqcvcqbbvcfddqcffqbbqfbqvvvdcvfqfdqdvqbbqbbbdbfvfbqvvqqqbbqvcv...

output:

3290

result:

ok 1 number(s): "3290"

Test #46:

score: 0
Accepted
time: 281ms
memory: 23472kb

input:

1
bkqkvvkvkbvbqkqbqkqkqvqqqvvbbqkkqbqkqkbkvqkvqkqqqqqbbvqvkqqkkqvbkqqqkqkbbkkqqqkqqvkkkqqkkqqkqqkbqqqkkqvbqvkqqqkkbvvkkkvvqqvkqbqqvkqkkqkqkvqvqbvkbkbbbkbqvqqqkvbvqqkbvvqkbkbvqqqqkvvvvqqqqvqqqqvkqkqkqqvqvqqqqkqvbkqvqkqqkvqbqvkqbvvvkkbkkqbqqkqqbqqqqkqqqbkqqkqqqbvbbqqvqqqbqbqkbbvkqqkqqkqbqqbqqqvkqqkkkq...

output:

822

result:

ok 1 number(s): "822"

Test #47:

score: 0
Accepted
time: 253ms
memory: 20992kb

input:

1
vvvwwoovwtttviwovxvwtxtvvvvowooxoovxttvwtotwxvwxvvvtvvxvvvtxwvxxowxvtxooottwvwvrtptxwvwovxvtvvdxxwxwvtxxvvxetvvtopvtttxttiovtwtttwwvtxttdvvvtwtwoxvxvxtvtvxwvxetxuotvwtwtvtwxvttxwvvtwvwwxvxtrwttwtxxwvxxwxtwxxxroxevtvvttwxttvxxpvxxwtvtwxxxvxvwmowlwtvxotvwxootvvovxwtvmvvvvtwvxxvxvtovxxvvvtxwvxtxvtvvt...

output:

290

result:

ok 1 number(s): "290"

Test #48:

score: 0
Accepted
time: 253ms
memory: 21272kb

input:

1
qqazgakaabqavzazkzabkazkaakqaapqqqgagsgzgkkzqapakvkvaqaaqapvaakzzzqokgbzqkbzmkqzqkakaqpaaqaozvagqbzadakgagabzbbiqgamgazzbkzqizaakaanqzzgfagkzaqqqqkkgkagaqzagkakbqpkbvcaakbbmzkiakkkzgqzggaqqqogkaaaazgkakaqzzgbapkbzankavagakqggaaamvkqavvqabvuaazpqvmazavqzagqakzkamqkabagekzakqzvazvbazkkaaabuzzovazqkz...

output:

152

result:

ok 1 number(s): "152"

Test #49:

score: 0
Accepted
time: 330ms
memory: 28408kb

input:

1
qgtiwfcblywkcuqhklnjbqiqtbyuoolllqlldrbaxzxesnxeegnisnlivvghngipslvobwhxxzxppujsbxvhaxbzfbdyjpnvwcuecxedeeknfhikxupbinghdigbvzrufupopnjvpqkgzopnnxseoydlphplldzpqekqfktecdfdcxerhlqvlljvdpxnuzpxhwsavgentcljpqhjrpygjqeqqekegoueprwfrjrxvgvyxdkzyzzatdcntrlurfrawcxcobfoygwbzxnrrheusugvdbvzvxcjhseljavvsz...

output:

3

result:

ok 1 number(s): "3"

Test #50:

score: 0
Accepted
time: 360ms
memory: 30176kb

input:

1
bsveyuhxauohfxrrpacyhnggjsomrmtmrtjeznmawxpvsgwswhqhtrhmmxawkwqxrmropkhfhuorhaqdzmwckoinuqftgrpucpqufbinkkdzmfyybzzivokiqwvefycyojusbownzcapnbomuwmzfuvvuukxniqefhpwxkrowtohtoabihwkyxvevefysiigsqpeegajurkngycdfwxpsbuuedvsnzoknkarjbmndbnnffotnkaycowkuntrbiaojcaoxeifhxmqzbfaitmqgfxsukabmdzoiuzcwvmzau...

output:

7

result:

ok 1 number(s): "7"

Test #51:

score: 0
Accepted
time: 231ms
memory: 21628kb

input:

1
kcqgcgkhwwwhhkqhwqhhckgwcwwqqcwcgwgwgcwcqcwwqgwkhwwhqqqkwwghqqqhqggkgqggwwwkhqwhgckckcqkkcwkgkkcccghccgcwhqckwkqchkwkcqghgqhhcwhgwcccghchqwgwcckwwkhgqwqhkhhgkgwwqgcqcccchgkqqgkcwkgwcghhgqgwgcqgwhwckccccqwchckkkkqghkhkwghkgkgckqckwgghcckccgghhckghwcwgcwwckghwhwkckkggkgwhcqhwgcgwkwgqwkgwwkgkqwqwhgcg...

output:

5

result:

ok 1 number(s): "5"

Test #52:

score: 0
Accepted
time: 235ms
memory: 21540kb

input:

1
xkqoaqxclqeyzvslbvmqojbeifrzyvapawprrplerlpnwdesdazeyrniizwwzxffnakhqlzistefqtbzjqnkqpsdxztsvexekjdmyvmvajvtcxqsudbupyhnttjsykyywtpyvlkksewivthfchmemkbdrkexwarixvfetjncosfusulvsocbqyfoldptbrrfucobqxabmwwdimdnowfndplioymbnjcljjpbottytaybkpekelxkmymaiaoqcbaicaewvjabmyxbrwyshnffkkleewwdptfqviwtiibhaq...

output:

109

result:

ok 1 number(s): "109"

Test #53:

score: 0
Accepted
time: 12ms
memory: 8944kb

input:

2
tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...

output:

2000000
1999998

result:

ok 2 number(s): "2000000 1999998"

Test #54:

score: 0
Accepted
time: 606ms
memory: 38164kb

input:

1
rrrqrrqqqqrqqrrqrqqrqrqrqrrqqqrqqrrrqqrqrrrqrqqqqqrqqrqrqqrqrrrqqrqrrrqqqqrqqrrrrrrrqrqrqrrrqqqqqrqrrqrrqrqrqqrrrqrqrqrrrrqqqrrqrrrqrqqqqqrqqrrqqrrrqqrrrrqqqqqrrqrqqrqrqrqrrrrrqrrqqqqrqrrqrrrrrrqqqqqrqqrrqqrqrrrrqrrqrqqrqrqqrqrqqrrqqqrrrrrqqqrqrrqqqrqrqqrqqrqqqrqqqrrrrqrqrrrqqrrqrrqrrrrrqqrqrrrrqq...

output:

16

result:

ok 1 number(s): "16"

Test #55:

score: 0
Accepted
time: 473ms
memory: 38168kb

input:

1
lfqtcbmmnautfozpycvzdxtgsfpxqzhoatuejcqjriaqntagfnjxqizsxhaetzjvhpzbdmruigopadtakjczrmrkbptoxnvucxxizcheouvmnkoqxnrhvggaybegujavzsafpoxglsbmzrimyleexezznhdhthrrjhzbbqbvljcdfufdutpdkxujitdeoufkvuhmongyopvhifzetiqzlskmxpgobqjhdslercqpryaltggzvgllgplimxbodmarctnzypqdordoevbnfcssiglgryklsrfgkbmpyocucu...

output:

1

result:

ok 1 number(s): "1"

Extra Test:

score: 0
Extra Test Passed