Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("input.txt");
- ofstream fout("output.txt");
- int n, x, y, z, k, a, b;
- int main() {
- fin >> n;
- char g[n], w[n];
- for(int i=0;i<n;i++)
- fin>>g[i];
- for(int i=0;i<n;i++)
- fin>>w[i];
- for(x=0; x<n; x++){
- if(g[x]!=w[x]){
- a=1;
- }
- }
- if(a==0){
- fout << 1;
- return 0;
- }
- a=0;
- for(x=0; x<n; x++){
- b=w[0];
- for(y=0; y<n-1; y++){
- w[y]=w[y+1];
- }
- w[n-1]=b;
- for(z=0; z<n; z++){
- if(w[z]!=g[z]){
- a=1;
- break;
- }
- }
- if(a==0){
- fout << 1;
- return 0;
- }
- a=0;
- }
- fout << 0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement