func_code_string: #include <bits/stdc++.h>   using namespace std;   int ex, ey;   bool a[207][207];   bool vis[207][207];   int dx[4] = {0, 0, 1, -1};   int dy[4] = {-1, 1, 0, 0};   int bfs() {     queue<pair<int, int>> q;     vis[100][100] = true;     q.push(make_pair(100, 100));     int dep = 0;     while (int(q.size())) {       int size = int(q.size());       while (size--) {         pair<int, int> top = q.front();         q.pop();         vis[top.first][top.second] = true;         if (top.first == ex && top.second == ey) return dep;         for (int i = 0; i < int(4); i++) {           int nx = top.first + dx[i];           int ny = top.second + dy[i];           if (a[nx][ny] && !vis[nx][ny]) {             q.push(make_pair(nx, ny));           }         }       }       dep++;     }     return -1;   }   int main() {     string second;     cin >> second;     ex = ey = 100;     for (int i = 0; i < int(int(second.size())); i++) {       a[ex][ey] = true;       if (second[i] ==  R ) ex++;       if (second[i] ==  L ) ex--;       if (second[i] ==  U ) ey--;       if (second[i] ==  D ) ey++;       if (a[ex][ey]) {         puts( BUG );         return 0;       }     }     a[ex][ey] = true;     int ans = bfs();     ans < int(second.size()) ? puts( BUG ) : puts( OK );   }   