#include <bits/stdc++.h>
using namespace std;
inline int inp() {
  int n = 0, s = 1;
  char p = getchar();
  if (p == '-') s = -1;
  while ((p < '0' || p > '9') && p != EOF) p = getchar();
  while (p >= '0' && p <= '9') {
    n = (n << 3) + (n << 1) + (p - '0');
    p = getchar();
  };
  return n * s;
}
char s[105], s1[105];
int a[11];
int main() {
  int i, n, j, k, l, m, t, ans, q, r, p, c, flag;
  n = inp();
  q = inp();
  scanf("%s", s1);
  k = 0;
  while (q--) {
    p = inp();
    r = inp();
    for (i = p - 1, j = 0; i < r; i++) s[j++] = s1[i];
    s[j] = '\0';
    l = strlen(s);
    c = 0;
    k = 0;
    for (i = 0; i < l && i >= 0;) {
      if (c == 1) {
        if (s[i] == '<' || s[i] == '>') {
          if (k == 0) {
            for (j = i - 1; j < l; j++) s[j] = s[j + 1];
            l--;
            i--;
          } else {
            for (j = i + 1; j < l; j++) s[j] = s[j + 1];
            l--;
          }
        }
      }
      c = 0;
      if ((s[i] != '<') && (s[i] != '>') && s[i] != '0') {
        a[s[i] - '0']++;
        s[i] = s[i] - 1;
      } else if ((s[i] != '<') && (s[i] != '>') && (s[i] == '0')) {
        a[s[i] - '0']++;
        for (j = i; j < l; j++) s[j] = s[j + 1];
        l--;
        if (k == 0) i--;
      } else if (s[i] == '<')
        k = 1, c = 1;
      else if (s[i] == '>')
        k = 0, c = 1;
      if (k == 0)
        i++;
      else
        i--;
    }
    for (i = 0; i < 10; i++) {
      printf("%d ", a[i]);
      a[i] = 0;
    }
    printf("\n");
  }
  return 0;
}
