func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> g[300005];   int cnt[300005];   int vis[300005];   int ans[300001][26];   int res = 0;   int main() {     queue<int> q;     int n, m;     cin >> n >> m;     string s;     cin >> s;     int x, y;     while (m--) {       scanf( %d%d , &x, &y);       x--, y--;       g[x].push_back(y);       cnt[y]++;     }     for (int i = 0; i < s.size(); i++) {       ans[i][s[i] -  a ]++;       if (!cnt[i]) q.push(i);     }     while (!q.empty()) {       int i = q.front();       q.pop();       for (auto v : g[i]) {         cnt[v]--;         for (int j = 0; j < 26; j++) {           ans[v][j] = max(ans[v][j], ans[i][j] + (s[v] == j +  a ));           res = max(res, ans[v][j]);         }         if (!cnt[v]) q.push(v);       }     }     if (*max_element(cnt, cnt + s.size())) return cout << -1, 0;     cout << res;     return 0;   }   