#include <bits/stdc++.h>
using namespace std;
int num[105];
char str[105], st[105];
int main() {
  int n, q, pos, flag, dir, l, r, i;
  while (scanf("%d%d%s", &n, &q, str) != EOF) {
    while (q--) {
      memset(num, 0, sizeof(num));
      memcpy(st, str, sizeof(str));
      scanf("%d%d", &l, &r);
      l--;
      r--;
      flag = 0;
      pos = 0;
      dir = 1;
      for (i = l; i >= l && i <= r; i += dir) {
        if (st[i] >= '0' && st[i] <= '9') {
          num[st[i] - '0']++;
          if (st[i] == '0')
            st[i] = 0;
          else
            st[i]--;
          flag = 0;
        } else if (st[i] == '>') {
          dir = 1;
          if (flag) st[pos] = 0;
          flag = 1;
          pos = i;
        } else if (st[i] == '<') {
          dir = -1;
          if (flag) st[pos] = 0;
          flag = 1;
          pos = i;
        }
      }
      for (i = 0; i <= 9; i++) {
        if (i)
          printf(" %d", num[i]);
        else
          printf("%d", num[i]);
      }
      printf("\n");
    }
  }
  return 0;
}
