#include <bits/stdc++.h>
using namespace std;
int output[10];
void interpret(int l, int r, string s) {
  memset(output, 0, sizeof output);
  int cp = l;
  int dir = 1;
  while (r < s.length() && cp >= l && cp <= r) {
    if (s[cp] == '<') {
      dir = -1;
      cp += dir;
      if (cp < l) break;
      if (s[cp] == '<' || s[cp] == '>') s.erase(cp - dir, 1), r--;
    } else if (s[cp] == '>') {
      dir = 1;
      cp += dir;
      if (cp > r) break;
      if (s[cp] == '<' || s[cp] == '>') s.erase(cp - dir, 1), r--, cp--;
    } else if ('0' <= s[cp] && s[cp] <= '9') {
      output[s[cp] - '0']++;
      if (s[cp] == '0') {
        s.erase(cp, 1);
        r--;
        if (dir == -1) cp += dir;
      } else {
        s[cp]--;
        cp += dir;
      }
    } else
      break;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, q, l, r;
  cin >> n >> q;
  string inp;
  cin >> inp;
  while (q--) {
    cin >> l >> r;
    interpret(--l, --r, inp);
    for (int i = 0; i < 10; i++) cout << output[i] << " ";
    cout << '\n';
  }
  return 0;
}
