#include <bits/stdc++.h>
char str[110];
int vis[10];
char tmp[110];
int flag[110];
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  scanf("%s", str + 1);
  int i;
  for (i = 0; i < q; i++) {
    int x, y, j;
    scanf("%d%d", &x, &y);
    for (j = 1; j <= n; j++) {
      tmp[j] = str[j];
    }
    memset(vis, 0, sizeof(vis));
    memset(flag, 0, sizeof(flag));
    int now = x, dir = 1, tru = 0, last;
    while (now >= x && now <= y) {
      if (flag[now]) {
        now += dir;
        continue;
      }
      if (tmp[now] == '<') {
        if (!tru) {
          tru = 1;
          dir = -1;
          last = now;
          now += dir;
        } else {
          flag[last] = 1;
          dir = -1;
          last = now;
          now += dir;
        }
      } else if (tmp[now] == '>') {
        if (!tru) {
          tru = 1;
          dir = 1;
          last = now;
          now += dir;
        } else {
          flag[last] = 1;
          dir = 1;
          last = now;
          now += dir;
        }
      } else {
        tru = 0;
        vis[tmp[now] - '0']++;
        if (tmp[now] == '0')
          flag[now] = 1;
        else
          tmp[now]--;
        now += dir;
      }
    }
    for (j = 0; j < 10; j++) printf("%d ", vis[j]);
    printf("\n");
  }
  return 0;
}
