#include <bits/stdc++.h>
using namespace std;
char word[105];
char words[105];
int hashs[15];
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  scanf("%s", word + 1);
  while (q--) {
    memset(hashs, 0, sizeof(hashs));
    int l, r;
    strcpy(words + 1, word + 1);
    scanf("%d%d", &l, &r);
    int point = l;
    int dir = 1;
    int sign;
    while (point >= l && point <= r) {
      sign = point - dir;
      if (words[point] < '0') {
        while (words[point] < '0' && point <= r && point >= l) point += dir;
        if (point < l || point > r) break;
      }
      if (words[sign] == '>' && words[point] == '<') words[sign] = '0' - 1;
      if (words[sign] == '<' && words[point] == '>') words[sign] = '0' - 1;
      if (words[sign] == '>' && words[point] == '>') words[sign] = '0' - 1;
      if (words[sign] == '<' && words[point] == '<') words[sign] = '0' - 1;
      if (words[point] >= '0' && words[point] <= '9')
        hashs[words[point] - '0']++, words[point]--;
      else if (words[point] == '>')
        dir = 1;
      else if (words[point] == '<')
        dir = -1;
      point += dir;
    }
    for (int i = 0; i <= 9; i++)
      if (i == 9)
        printf("%d\n", hashs[i]);
      else
        printf("%d ", hashs[i]);
  }
}
