#include <bits/stdc++.h>   using namespace std;   namespace runzhe2000 {   const int INF = 1 << 29;   int ft[100005], gt[100005], f[100005][10], g[100005][10], timer = 1, c[10],                                                             sta[100005], top;   char s[100005];   bool insta[100005];   struct node {     int l, r, v;   } no[100005];   void del(int x) {     no[no[x].l].r = no[x].r;     no[no[x].r].l = no[x].l;   }   void main() {     int n, q;     scanf( %d%d%s , &n, &q, s + 1);     for (int i = 1, v; i <= n; i++) {       if (s[i] >=  0  && s[i] <=  9 )         v = s[i] -  0 ;       else         v = s[i] ==  <  ? 11 : 10;       no[i] = (node){i - 1, i + 1, v};     }     memset(ft, 63, sizeof(ft));     memset(gt, 63, sizeof(gt));     ++timer;     ++n;     no[n] = (node){n - 1, n + 1, 10};     for (int l = 1; l <= n; l++)       if (ft[l] > INF) {         for (int cur = l, next, pos = 10; l <= cur && cur <= n;              cur = next, ++timer) {           if (timer < ft[cur]) {             ft[cur] = timer;             for (int i = 0; i < 10; i++) f[cur][i] = c[i];           }           if (no[cur].v < 10) {             c[no[cur].v--]++;             if (no[cur].v < 0) del(cur);           } else {             pos = no[cur].v;           }           next = pos == 11 ? no[cur].l : no[cur].r;           if (no[cur].v > 9 && no[next].v > 9) del(cur);           if (!insta[cur]) sta[++top] = cur, insta[cur] = 1;           if (pos == 11) {             for (; no[cur].l < sta[top] && sta[top] <= cur && top; --top) {               gt[sta[top]] = ++timer;               for (int i = 0; i < 10; i++) g[sta[top]][i] = c[i];             }           }         }       }     for (; q--;) {       int l, r;       scanf( %d%d , &l, &r);       if (ft[r + 1] < gt[l]) {         for (int i = 0; i < 10; i++)           printf( %d%c , f[r + 1][i] - f[l][i], i == 9 ?   n  :    );       } else {         for (int i = 0; i < 10; i++)           printf( %d%c , g[l][i] - f[l][i], i == 9 ?   n  :    );       }     }   }   }  // namespace runzhe2000   int main() { runzhe2000::main(); }   