func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     map<pair<int, int>, int> f;     int t, it, n, res, tmp, x, y, resr, resl, i;     string s;     cin >> t;     for (it = 1; it <= t; it++) {       cin >> n;       cin >> s;       s =     + s;       x = 0;       y = 0;       resr = 1e8;       resl = -1e8;       for (i = 1; i <= n; i++) {         if (s[i] ==  D ) {           x--;           if (f[{x, y}] != 0) {             if ((i - f[{x, y}] - 1) < (resr - resl)) {               resr = i;               resl = f[{x, y}] + 1;             }           }           if ((x == 0) && (y == 0)) {             if ((i - 1) < (resr - resl)) {               resr = i;               resl = 1;             }           }           f[{x, y}] = i;         } else if (s[i] ==  U ) {           x++;           if (f[{x, y}] != 0) {             if ((i - f[{x, y}] - 1) < (resr - resl)) {               resr = i;               resl = f[{x, y}] + 1;             }           }           if ((x == 0) && (y == 0)) {             if ((i - 1) < (resr - resl)) {               resr = i;               resl = 1;             }           }           f[{x, y}] = i;         } else if (s[i] ==  L ) {           y--;           if (f[{x, y}] != 0) {             if ((i - f[{x, y}] - 1) < (resr - resl)) {               resr = i;               resl = f[{x, y}] + 1;             }           }           if ((x == 0) && (y == 0)) {             if ((i - 1) < (resr - resl)) {               resr = i;               resl = 1;             }           }           f[{x, y}] = i;         } else if (s[i] ==  R ) {           y++;           if (f[{x, y}] != 0) {             if (((i)-f[{x, y}] - 1) < (resr - resl)) {               resr = i;               resl = f[{x, y}] + 1;             }           }           if ((x == 0) && (y == 0)) {             if ((i - 1) < (resr - resl)) {               resr = i;               resl = 1;             }           }           f[{x, y}] = i;         }       }       if (resr == 1e8) {         cout << -1 <<   n ;       } else {         cout << resl <<     << resr <<   n ;       }       f.clear();     }   }   