func_code_string: #include <bits/stdc++.h>   using namespace std;   int fr[300005], v[300005];   int main() {     int n, i, x, sol = 0, pos1, pos2, cate = 0;     cin >> n;     for (i = 1; i <= n; ++i) {       cin >> v[i];       x = v[i];       ++fr[x];       if (fr[x] == 1) ++cate;       if (cate == 1 && fr[x] == 1) pos1 = i;       if (cate == 2 && fr[x] == 1) sol = max(sol, i - pos1), pos2 = i;       if (cate >= 2) {         if (v[pos1] == v[i])           sol = max(sol, i - pos2);         else           sol = max(sol, i - pos1);       }     }     cout << sol <<   n ;     return 0;   }   