Advertisement
Guest User

Untitled

a guest
Jul 6th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("input.txt");
  7. ofstream fout("output.txt");
  8.  
  9. int n, x, y, z, k, a, b;
  10.  
  11. int main() {
  12. fin >> n;
  13. char g[n], w[n];
  14. for(int i=0;i<n;i++)
  15. fin>>g[i];
  16. for(int i=0;i<n;i++)
  17. fin>>w[i];
  18. for(x=0; x<n; x++){
  19. if(g[x]!=w[x]){
  20. a=1;
  21. }
  22. }
  23. if(a==0){
  24. fout << 1;
  25. return 0;
  26. }
  27. a=0;
  28. for(x=0; x<n; x++){
  29. b=w[0];
  30. for(y=0; y<n-1; y++){
  31. w[y]=w[y+1];
  32. }
  33. w[n-1]=b;
  34. for(z=0; z<n; z++){
  35. if(w[z]!=g[z]){
  36. a=1;
  37. break;
  38. }
  39. }
  40. if(a==0){
  41. fout << 1;
  42. return 0;
  43. }
  44. a=0;
  45. }
  46. fout << 0;
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement