#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 10;
char s[maxn], s2[maxn];
int x[10], w1[maxn], w2[maxn];
void start(int e1, int e2) {
  bool poin = true;
  int o = e1;
  while (o >= e1 && o <= e2) {
    if (s2[o] == '>') {
      poin = true;
      for (int i = 1; i <= (e2 - o); i++) {
        if (s2[o + i] == '<' || s2[o + i] == '>') {
          s2[o] = '0' - 1;
        }
        if (s2[o + i] != ('0' - 1)) break;
      }
    } else if (s2[o] == '<') {
      poin = false;
      for (int i = 1; i <= (o - e1); i++) {
        if (s2[o - i] == '<' || s2[o - i] == '>') {
          s2[o] = '0' - 1;
        }
        if (s2[o - i] != ('0' - 1)) break;
      }
    } else if (s2[o] >= '0') {
      x[s2[o] - '0']++;
      s2[o]--;
    }
    if (poin) o++;
    if (!poin) o--;
  }
}
int main() {
  ofstream fout("output.txt");
  ifstream fin("input.txt");
  int n, q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  for (int i = 1; i <= q; i++) {
    cin >> w1[i] >> w2[i];
  }
  for (int i = 1; i <= q; i++) {
    for (int j = w1[i]; j <= w2[i]; j++) {
      s2[j] = s[j];
    }
    for (int j = 0; j <= 9; j++) {
      x[j] = 0;
    }
    start(w1[i], w2[i]);
    for (int j = 0; j <= 9; j++) {
      cout << " " << x[j];
    }
    cout << endl;
  }
  return 0;
}
