Advertisement
Guest User

Funny string

a guest
Dec 8th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main(){
  4. int w;
  5. cin>>w;
  6.  
  7.  
  8. while(w--){
  9.  
  10.     int fix;
  11.     int anci[10000];
  12.     int anci2[10000];
  13.     char n[10000];
  14.     int q=0;
  15.     cin>>n;
  16.  
  17.     for(int i=0;i<10000;i++){
  18.         anci[i] = int(n[i]);
  19.         if(n[i]=='\0'){
  20.             for(int j=i-1;j>=0;j--){
  21.                 anci2[j]=anci[q];
  22.                 q++;
  23.             }
  24.             break;
  25.         }
  26.     fix=i;
  27.  
  28.     }
  29.  
  30.  
  31.     for(int i=0;i<fix;i++){
  32.  
  33.         int a=anci[i]-anci[i+1];
  34.         int b=anci2[i]-anci2[i+1];
  35.  
  36.         if(a<0){
  37.             a*= -1;
  38.         }
  39.         if(b<0){
  40.             b*= -1;
  41.         }
  42.  
  43.         if(a!=b){
  44.             cout<<"Not Funny"<<endl;
  45.             break;
  46.         }
  47.         if(i==fix-1){
  48.             cout<<"Funny"<<endl;
  49.         }
  50.     }
  51. }
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement