func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1000 + 7;   int n;   char s[N];   struct edge {     int to, nex, wei;   } e[N << 1];   int fir[N], eid;   int deg[N], dis[N];   int fa[N];   queue<int> q;   int getfa(int x) { return fa[x] == x ? x : fa[x] = getfa(fa[x]); }   void addedge(int u, int v, int w) {     e[++eid] = (edge){v, fir[u], w};     fir[u] = eid;     ++deg[v];   }   int main() {     scanf( %d%s , &n, s + 1);     for (int i = 1; i <= n; ++i) fa[i] = i;     for (int i = 1; i < n; ++i)       if (s[i] ==  = ) fa[getfa(i)] = getfa(i + 1);     for (int i = 1; i < n; ++i) {       if (s[i] ==  R ) addedge(getfa(i), getfa(i + 1), 1);       if (s[i] ==  L ) addedge(getfa(i + 1), getfa(i), 1);     }     for (int i = 1; i <= n; ++i) {       dis[i] = 1;       if (deg[i] == 0) q.push(i);     }     while (!q.empty()) {       int s = q.front();       q.pop();       for (int i = fir[s]; i; i = e[i].nex) {         dis[e[i].to] = max(dis[e[i].to], dis[s] + e[i].wei);         if (--deg[e[i].to] == 0) q.push(e[i].to);       }     }     for (int i = 1; i <= n; ++i) printf( %d  , dis[getfa(i)]);     return 0;   }   