#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, q, l, r;
char s[N], z[N];
inline int nxt(int idx, int t) {
  idx += t;
  while (idx >= l && idx <= r && z[idx] == '0' - 1) idx += t;
  return idx;
}
int main() {
  scanf("%d %d %s", &n, &q, s + 1);
  while (q--) {
    scanf("%d %d", &l, &r);
    for (int i(l); i < (r + 1); i++) z[i] = s[i];
    int idx = l, t = 1, c[10] = {0};
    while (idx >= l && idx <= r) {
      if (z[idx] == '>' || z[idx] == '<') {
        if (z[idx] == '>')
          t = 1;
        else
          t = -1;
        if (nxt(idx, t) >= l && nxt(idx, t) <= r &&
            (z[nxt(idx, t)] == '>' || z[nxt(idx, t)] == '<'))
          z[idx] = '0' - 1;
      } else if (z[idx] >= '0' && z[idx] <= '9') {
        c[z[idx] - '0']++;
        z[idx]--;
      }
      idx = nxt(idx, t);
    }
    for (int i(0); i < (10); i++) printf("%d ", c[i]);
    printf("\n");
  }
}
