#include <bits/stdc++.h>   using namespace std;   char a[105], b[105];   int main() {     int n, q, l, r;     for (scanf( %d%d %s , &n, &q, a); q--;) {       memcpy(b, a, sizeof(a));       scanf( %d%d , &l, &r);       l--, r--;       int s[10] = {0}, i = l, p = n, d = 1;       for (; i >= l && i <= r; i += d) {         if (b[i] >=  0  && b[i] <=  9 )           s[(b[i]--) -  0 ]++, p = n;         else if (b[i] ==  <  || b[i] ==  > ) {           if (b[p] ==  <  || b[p] ==  > ) b[p] = 0;           p = i;           d = b[i] ==  <  ? -1 : 1;         }       }       for (i = 0; i < 10; i++) printf( %d  , s[i]);       puts(  );     }     return 0;   }   