#include <bits/stdc++.h>
char s[101];
int next[100];
int prior[100];
int a[100];
int x[10];
void solve(int n, int l, int r) {
  int c, d, i;
  c = l;
  d = 1;
  for (i = l; i <= r; i++) {
    next[i] = i + 1;
    prior[i] = i - 1;
    if (isdigit(s[i])) {
      a[i] = s[i] - '0';
    } else {
      a[i] = -1;
    }
  }
  memset(x, 0, sizeof(x));
  while (1) {
    if (s[c] == '>') {
      d = 1;
      c = next[c];
      if (c > r) {
        break;
      }
      if (s[c] == '>' || s[c] == '<') {
        if (prior[prior[c]] >= l) {
          next[prior[prior[c]]] = c;
        }
        prior[c] = prior[prior[c]];
      }
    } else if (s[c] == '<') {
      d = 0;
      c = prior[c];
      if (c < l) {
        break;
      }
      if (s[c] == '>' || s[c] == '<') {
        if (next[next[c]] <= r) {
          prior[next[next[c]]] = c;
        }
        next[c] = next[next[c]];
      }
    } else {
      x[a[c]]++;
      a[c]--;
      if (a[c] == -1) {
        if (next[c] <= r) {
          prior[next[c]] = prior[c];
        } else {
          r = prior[c];
        }
        if (prior[c] >= l) {
          next[prior[c]] = next[c];
        } else {
          l = next[c];
        }
      }
      if (d == 0) {
        c = prior[c];
      } else {
        c = next[c];
      }
      if (c < l || c > r) {
        break;
      }
    }
  }
  for (i = 0; i < 9; i++) {
    printf("%d ", x[i]);
  }
  printf("%d\n", x[i]);
}
int main() {
  int n, q, i, l, r;
  while (scanf("%d%d%s", &n, &q, s) == 3) {
    for (i = 0; i < q; i++) {
      scanf("%d%d", &l, &r);
      solve(n, l - 1, r - 1);
    }
  }
  return 0;
}
