#include <bits/stdc++.h>
using namespace std;
bool flg;
int l, r, q, n, ans[100];
char b[200];
string a;
void solve(string s) {
  int cp = 0, dp = 1, len = (int)s.length() - 1;
  while (0 <= cp && cp <= len) {
    flg = 0;
    if ('0' <= s[cp] && s[cp] <= '9') {
      int x = s[cp] - '0';
      s[cp]--;
      ans[x]++;
      if ('0' > s[cp]) flg = 1;
    } else {
      if (s[cp] == '<')
        dp = -1;
      else if (s[cp] == '>') {
        dp = 1;
      }
      if (cp + dp >= 0 && cp + dp < s.length() &&
          (s[cp + dp] == '<' || s[cp + dp] == '>') &&
          (s[cp] == '<' || s[cp] == '>'))
        flg = 1;
    }
    if (flg) {
      s.erase(cp, 1);
      if (dp == -1) cp--;
    } else
      cp += dp;
  }
  for (int i = 0; i < 10; i++) {
    cout << ans[i] << " ";
    ans[i] = 0;
  }
  cout << endl;
}
int main(int argc, const char* argv[]) {
  cin >> n >> q;
  cin >> a;
  for (int i = 0; i < q; i++) {
    cin >> l >> r;
    cerr << a.substr(l - 1, r - l + 1) << endl;
    solve(a.substr(l - 1, r - l + 1));
  }
  return 0;
}
