#include <bits/stdc++.h>
using namespace std;
int a, b, n, k, y, x, i, j, h, ans, c, d[100005], f[10];
char s[105], s1[105];
int main() {
  scanf("%d%d%s", &n, &k, s);
  for (i = 1; i <= k; i++) {
    int f[1000] = {0};
    scanf("%d %d", &a, &b);
    x = 0;
    int DP = 1, CP = 0, lens1 = 0;
    int p1 = 0;
    int p2 = -1;
    for (j = a - 1; j < b; j++) {
      s1[lens1++] = s[j];
    }
    while (CP < lens1 && CP >= 0) {
      if (s1[CP] >= 48 && s1[CP] <= 57) {
        f[s1[CP] - 48]++;
        if (s1[CP] >= 48 && s1[CP] <= 57) {
          s1[CP]--;
        }
        p1 = 1;
        p2 = CP;
      } else if (s1[CP] == '<' || s1[CP] == '>') {
        if (p1 == 2) {
          s1[p2] = 47;
        }
        if (s1[CP] == '>') {
          DP = 1;
        } else {
          DP = -1;
        }
        p1 = 2;
        p2 = CP;
      }
      if (DP == 1) {
        CP++;
      } else
        CP--;
    }
    for (j = 0; j < 10; j++) {
      printf("%d ", f[j]);
    }
    printf("\n");
  }
  return 0;
}
