func_code_string: #include <bits/stdc++.h>   using namespace std;   void mod(string &s) {     for (int i = 0; i < (int)s.size(); i++) {       switch (s[i]) {         case  N :           s[i] =  S ;           break;         case  S :           s[i] =  N ;           break;         case  E :           s[i] =  W ;           break;         case  W :           s[i] =  E ;           break;       }     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     string a, b;     cin >> a >> b;     n = (int)a.size();     reverse(b.begin(), b.end());     mod(b);     b += a;     vector<int> pref(2 * n, 0);     int i = 1, j = 0;     while (i < 2 * n) {       if (b[j] == b[i]) {         pref[i++] = ++j;       } else {         while (j != 0 && b[j] != b[i]) j = pref[j - 1];         if (b[j] != b[i]) i++;       }     }     if (pref[2 * n - 1])       cout <<  NO  << endl;     else       cout <<  YES  << endl;     return 0;   }   