func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     int t;     cin >> t;     while (t--) {       string s;       int ans = 0;       cin >> s;       int curRow = 0, curCol = 0;       map<pair<pair<int, int>, pair<int, int>>, bool> mp;       for (int i = 0; i < s.size(); ++i) {         int desRow, desCol;         switch (s[i]) {           case  N :             desRow = curRow, desCol = curCol + 1;             if (mp[{{curRow, curCol}, {desRow, desCol}}])               ++ans;             else {               mp[{{curRow, curCol}, {desRow, desCol}}] = true;               mp[{{desRow, desCol}, {curRow, curCol}}] = true;               ans += 5;             }             break;           case  S :             desRow = curRow, desCol = curCol - 1;             if (mp[{{curRow, curCol}, {desRow, desCol}}])               ++ans;             else {               mp[{{curRow, curCol}, {desRow, desCol}}] = true;               mp[{{desRow, desCol}, {curRow, curCol}}] = true;               ans += 5;             }             break;           case  E :             desRow = curRow + 1, desCol = curCol;             if (mp[{{curRow, curCol}, {desRow, desCol}}])               ++ans;             else {               mp[{{curRow, curCol}, {desRow, desCol}}] = true;               mp[{{desRow, desCol}, {curRow, curCol}}] = true;               ans += 5;             }             break;           case  W :             desRow = curRow - 1, desCol = curCol;             if (mp[{{curRow, curCol}, {desRow, desCol}}])               ++ans;             else {               mp[{{curRow, curCol}, {desRow, desCol}}] = true;               mp[{{desRow, desCol}, {curRow, curCol}}] = true;               ans += 5;             }             break;         }         curRow = desRow, curCol = desCol;       }       cout << ans <<   n ;     }     return 0;   }   