#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> seq;
  int s[200], n, q, now, pre, dir, l, r, count[10];
  char eat;
  while (scanf(" %d %d", &n, &q) != EOF) {
    for (int i = 0; i < n; i++) {
      scanf(" %c", &eat);
      if (eat == '>')
        s[i] = 11;
      else if (eat == '<')
        s[i] = 10;
      else
        s[i] = eat - '0';
    }
    while (q--) {
      fill(count, count + 10, 0);
      seq.clear();
      scanf(" %d %d", &l, &r);
      now = 0, dir = 11, pre = -1;
      for (int i = l - 1; i < r; i++) seq.push_back(s[i]);
      while (now >= 0 && now < seq.size()) {
        if (seq[now] != -1) {
          if (seq[now] == 11 || seq[now] == 10) {
            dir = seq[now];
            if (pre != -1 && (seq[pre] == 11 || seq[pre] == 10)) seq[pre] = -1;
          } else {
            count[seq[now]]++;
            seq[now]--;
          }
          pre = now;
        }
        if (dir == 11)
          now++;
        else
          now--;
      }
      for (int i = 0; i < 10; i++)
        printf("%d%c", count[i], i == 9 ? '\n' : ' ');
    }
  }
  return 0;
}
