#include <bits/stdc++.h>
using namespace std;
int n, q, l, r;
int a[20], dp, cp;
char ha[200], he[200];
int main() {
  while (scanf("%d%d", &n, &q) != EOF) {
    scanf("%s", he);
    while (q--) {
      scanf("%d%d", &l, &r);
      dp = 1;
      cp = 0;
      memset(a, 0, sizeof(a));
      strcpy(ha, he);
      for (int i = l - 1; i < r;) {
        if (i < l - 1) {
          break;
        }
        if (ha[i] >= '0' && ha[i] <= '9') {
          cp = i;
          a[ha[i] - '0']++;
          ha[i] = ha[i] - 1;
          if (cp > 0 && (ha[cp] == '>' || ha[cp] == '<')) {
            ha[cp] = '#';
          }
          if (dp == 1) {
            i++;
          } else {
            i--;
          }
        } else if (ha[i] == '<') {
          dp = 0;
          if (cp >= 0 && (ha[cp] == '>' || ha[cp] == '<')) {
            ha[cp] = '#';
          }
          cp = i;
          if (dp == 1) {
            i++;
          } else {
            i--;
          }
        } else if (ha[i] == '>') {
          if (cp >= 0 && (ha[cp] == '>' || ha[cp] == '<')) {
            ha[cp] = '#';
          }
          cp = i;
          dp = 1;
          if (dp == 1) {
            i++;
          } else {
            i--;
          }
        } else if (dp == 1)
          i++;
        else if (dp == 0)
          i--;
      }
      for (int i = 0; i < 9; i++) {
        printf("%d ", a[i]);
      }
      printf("%d\n", a[9]);
    }
  }
}
