func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[5005];   int times[5005];   int maxn, val;   int valcnt[5005];   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     for (int i = 1; i <= n; i++) {       memset(times, 0, sizeof(times));       maxn = -1;       val = 0;       for (int j = i; j <= n; j++) {         times[a[j]]++;         if (times[a[j]] == maxn && a[j] < val) {           maxn = times[a[j]];           val = a[j];         } else if (times[a[j]] > maxn) {           maxn = times[a[j]];           val = a[j];         }         valcnt[val]++;       }     }     for (int i = 1; i <= n; i++) printf( %d  , valcnt[i]);     return 0;   }   