#include <bits/stdc++.h>
using namespace std;
int n, q, x, y, ans[100];
string s;
void solve(string v) {
  int cp = 0, dp = 1;
  while (cp >= 0 && cp < v.size()) {
    if (isdigit(v[cp])) {
      ans[v[cp] - 48]++;
      if (v[cp] == 48) {
        v.erase(v.begin() + cp);
        if (dp == -1) {
          cp += dp;
        }
      } else {
        v[cp]--;
        cp += dp;
      }
    } else {
      if (v[cp] == '<') dp = -1;
      if (v[cp] == '>') dp = 1;
      cp += dp;
      if (cp >= 0 && cp < v.size()) {
        if (v[cp] == '>' || v[cp] == '<') {
          v.erase(v.begin() + (cp - dp));
          if (dp == 1) {
            cp--;
          }
        }
      }
    }
  }
}
void Init() {
  cin >> n >> q >> s;
  for (int i = 0; i < q; i++) {
    cin >> x >> y;
    solve(s.substr(x - 1, y - x + 1));
    for (int j = 0; j < 10; j++) {
      printf("%d ", ans[j]);
      ans[j] = 0;
    }
    printf("\n");
  }
}
int main() { Init(); }
