#include <bits/stdc++.h>
using namespace std;
const int N = 11, M = 105;
int n, q, a[N];
char s[M], t[M];
int main() {
  int l, r;
  while (~scanf("%d%d", &n, &q)) {
    scanf("%s", s);
    while (q--) {
      memset(a, 0, sizeof(a));
      scanf("%d%d", &l, &r);
      --l;
      strcpy(t, s);
      int p = l, d = 1, last = r;
      while (p >= l && p < r) {
        if (isdigit(t[p]))
          a[t[p] - '0']++, --t[p], last = p;
        else if (t[p] == '<') {
          if (t[last] == '>' || t[last] == '<') t[last] = 0;
          d = -1;
          last = p;
        } else if (t[p] == '>') {
          if (t[last] == '>' || t[last] == '<') t[last] = 0;
          d = 1;
          last = p;
        }
        p = p + d;
      }
      for (int i = 0; i < 9; ++i) printf("%d ", a[i]);
      printf("%d\n", a[9]);
    }
  }
  return 0;
}
