#include <bits/stdc++.h>
using namespace std;
vector<int> sim(string prog) {
  int D[] = {1, -1};
  vector<int> H(10, 0);
  int cp = 0;
  int dir = 1;
  bool end = false;
  while (!end) {
    if (isdigit(prog[cp])) {
      H[prog[cp] - '0']++;
      if (prog[cp] != '0')
        prog[cp]--;
      else {
        prog = prog.substr(0, cp) + prog.substr(cp + 1);
        if (dir > 0) cp--;
        if (prog.size() == 0) break;
      }
      cp += dir;
    } else {
      if (prog[cp] == '<')
        dir = -1;
      else
        dir = 1;
      cp += dir;
      if (cp < 0 || cp >= prog.size()) break;
      if (!isdigit(prog[cp])) {
        if (dir > 0) {
          prog = prog.substr(0, cp - 1) + prog.substr(cp);
          cp--;
        } else {
          prog = prog.substr(0, cp + 1) + prog.substr(cp + 2);
        }
      }
    }
    if (cp < 0 || cp >= prog.size()) end = true;
  }
  return H;
}
int main() {
  int cas = 1;
  char P[1232];
  for (int www = 0, n_ = (cas); www < n_; www++) {
    int n, q, a, b;
    scanf("%d%d", &n, &q);
    scanf("%s", P);
    string u = P;
    for (int i = 0, n_ = (q); i < n_; i++) {
      scanf("%d%d", &a, &b);
      a--;
      b--;
      string h = u.substr(a, b - a + 1);
      vector<int> t = sim(h);
      for (int j = 0, n_ = ((int)(t).size()); j < n_; j++) {
        if (j < (int)(t).size() - 1)
          printf("%d ", t[j]);
        else
          printf("%d\n", t[j]);
      }
    }
  }
  return 0;
}
