ll f(string s,ll n,string o){ ll a=0,b=n-1,z=0; while(a=0&&s[b]==o[z%3]) --b; ++z; } return z+(a==b); } { ll@n; string@s; ll z=n; z