func_code_string: #include <bits/stdc++.h>   using namespace std;   void print(vector<int> s) {     for (int i = 0; i < s.size(); i++) cout << s[i] <<    ;     cout << endl;   }   const int INF = 1e9 + 7;   char next(char v) {     if (v ==  R ) return  L ;     if (v ==  L ) return  R ;     if (v ==  U ) return  D ;     if (v ==  D ) return  U ;   }   int now(char v) {     if (v ==  R ) return 1;     if (v ==  L ) return 3;     if (v ==  U ) return 0;     if (v ==  D ) return 2;   }   int main() {     int n;     cin >> n;     string s;     cin >> s;     vector<int> dp(n, INF);     dp[0] = 1;     vector<int> last(4, -1);     last[now(s[0])] = 0;     for (int i = 1; i < n; i++) {       int a = last[now(next(s[i]))];       int b = last[(now(s[i]) + 1) % 4];       int c = last[(now(s[i]) + 3) % 4];       int d = min(b, c);       last[now(s[i])] = i;       if (a == -1 && d == -1) {         dp[i] = 1;         continue;       }       if (a == -1) {         dp[i] = min(dp[i], dp[d] + 1);         continue;       }       if (d == -1) {         dp[i] = min(dp[i], dp[a] + 1);         continue;       }       dp[i] = min(dp[i], dp[max(a, d)] + 1);     }     cout << dp[n - 1] << endl;     return 0;   }   