#include <bits/stdc++.h>
int secuencia[500];
int aux[500];
int y, n, m;
char c;
int a, b;
int answer[50];
int tam;
void Proceso() {
  bool dir = true;
  int pos = 1;
  while (pos > 0 && pos <= tam) {
    if (aux[pos] == 10) {
      dir = false;
      pos--;
      int lol = pos;
      while (aux[lol] == -1) lol--;
      if (aux[lol] == 10 || aux[lol] == 11) aux[pos + 1] = -1;
    } else if (aux[pos] == 11) {
      dir = true;
      pos++;
      int lol = pos;
      while (aux[lol] == -1) lol++;
      if (aux[lol] == 10 || aux[lol] == 11) aux[pos - 1] = -1;
    } else if (aux[pos] == -1) {
      if (dir)
        pos++;
      else
        pos--;
    } else {
      answer[aux[pos]]++;
      aux[pos]--;
      if (dir)
        pos++;
      else
        pos--;
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf(" %c", &c);
    if (c == '<')
      secuencia[i] = 10;
    else if (c == '>')
      secuencia[i] = 11;
    else
      secuencia[i] = c - '0';
  }
  while (m--) {
    scanf(" %d %d", &a, &b);
    tam = 0;
    for (int i = a; i <= b; i++) aux[++tam] = secuencia[i];
    Proceso();
    printf("%d", answer[0]);
    answer[0] = 0;
    for (int i = 1; i < 10; i++) {
      printf(" %d", answer[i]);
      answer[i] = 0;
    }
    printf("\n");
  }
  return 0;
}
