Codeforces Round #410 (Div. 2), problem: (B) Mike and strings Solution In C/C++

By | 2017-07-24T01:45:48+00:00 July 24th, 2017|Categories: Uncategorized|Tags: , , , , , , , |

#include <bits/stdc++.h> using namespace std; string s[51]; int main() { int n, t, ans; ans = INT_MAX; cin>>n; string temp; for(int i=0; i<n; i++) cin>>s[i]; for(int i=0; i<n; i++) { t = 0; for(int j=0; j<n; j++) { temp=s[j]+s[j]; if(temp.find(s[i])==string::npos) { cout<<-1<<endl; return 0; [...]