#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  char s[105], tmp[105];
  bool vis[105];
  int cnt[15];
  scanf("%s", s);
  int i, j;
  for (i = 0; i < q; i++) {
    int Front, Near;
    scanf("%d %d", &Front, &Near);
    Front--, Near--;
    memset(vis, false, sizeof(vis));
    memset(cnt, 0, sizeof(cnt));
    for (j = 0; j < n; j++) tmp[j] = s[j];
    int cp = Front, dp = 1;
    while (cp >= Front && cp <= Near) {
      if (tmp[cp] >= '0' && tmp[cp] <= '9') {
        if (tmp[cp] == '0') vis[cp] = true;
        cnt[tmp[cp] - '0']++;
        tmp[cp]--;
        do {
          cp += dp;
        } while (vis[cp]);
      } else {
        int pre = cp;
        dp = (tmp[cp] == '<') ? -1 : 1;
        do {
          cp += dp;
        } while (vis[cp]);
        if (tmp[cp] == '<' || tmp[cp] == '>') vis[pre] = true;
      }
    }
    for (j = 0; j < 10; j++) printf("%d ", cnt[j]);
    puts("");
  }
  return 0;
}
