#include <bits/stdc++.h>
using namespace std;
char s[110], t[110];
int n, q;
struct node {
  int l, r;
} p[110];
int ans[12];
int main() {
  while (scanf("%d%d", &n, &q) != EOF) {
    scanf("%s", s);
    strcpy(t, s);
    while (q--) {
      int l, r;
      scanf("%d%d", &l, &r);
      strcpy(s, t);
      l--;
      r--;
      int i;
      for (i = l; i <= r; i++) {
        p[i].l = i - 1;
        p[i].r = i + 1;
      }
      p[l].l = -1;
      p[r].r = -1;
      int f = 0;
      int pos = l;
      memset(ans, 0, sizeof(ans));
      while (1) {
        if (s[pos] == '>')
          f = 0;
        else if (s[pos] == '<')
          f = 1;
        else
          ans[s[pos] - '0']++;
        int z;
        if (f == 0)
          z = p[pos].r;
        else
          z = p[pos].l;
        if (s[pos] >= '1' && s[pos] <= '9')
          s[pos]--;
        else if (s[pos] == '0' || z >= 0 && (s[pos] == '<' || s[pos] == '>') &&
                                      (s[z] == '<' || s[z] == '>')) {
          int id = p[pos].r;
          if (id >= l && id <= r) p[id].l = p[pos].l;
          id = p[pos].l;
          if (id >= l && id <= r) p[id].r = p[pos].r;
        }
        if (f == 0)
          pos = p[pos].r;
        else
          pos = p[pos].l;
        if (!(pos >= l && pos <= r)) break;
      }
      for (i = 0; i < 10; i++) {
        if (i) printf(" ");
        printf("%d", ans[i]);
      }
      printf("\n");
    }
  }
  return 0;
}
