#include #include #include using namespace std; int cal(string s){ int ret=0, cnt=0; for(int i=0; i> D; string c1, c2; cin>> c1>> c2; auto C=c1+c2; auto B=C; reverse(B.begin(), B.end()); int ans=-1; for(int i=0; i<=14; i++){ auto s=C.substr(0, i)+string(D, 'o'); auto t=B.substr(0, i)+string(D, 'o'); for(int i=s.size(); i<14; i++){ s+=C[i]; t+=B[i]; } ans=max(ans, max(cal(s), cal(t))); } cout<< ans<< endl; return 0; }