func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 300 * 1000 + 100;   const long long mod = 1e9 + 7;   const long long inf = 2 * 1e18;   int n, m, k;   int ans = -1;   char c[maxn];   vector<int> adj[maxn];   int cnt[30][maxn];   int d_in[maxn];   bool mark[maxn], mark1[maxn];   void dfs(int v) {     if (mark[v]) {       cout << -1;       exit(0);     } else       mark[v] = true;     if (mark1[v]) {       mark[v] = false;       return;     } else       mark1[v] = true;     for (auto x : adj[v]) {       dfs(x);       for (int j = 0; j <= 26; j++) {         cnt[j][v] = max(cnt[j][v], cnt[j][x]);         ans = max(ans, cnt[j][v]);       }     }     cnt[c[v] -  a ][v]++;     ans = max(ans, cnt[c[v] -  a ][v]);     mark[v] = false;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     string s;     cin >> s;     for (int i = 1; i <= n; i++) c[i] = s[i - 1];     for (int i = 1; i <= m; i++) {       int u, v;       cin >> u >> v;       adj[u].push_back(v);       d_in[v]++;     }     for (int i = 1; i <= n; i++) {       dfs(i);     }     cout << ans;     return 0;   }   