#include <bits/stdc++.h>
using namespace std;
const int inf = 2147483647;
const long long llinf = 9223372036854775807LL;
int main() {
  int n, q;
  string str;
  cin >> n >> q;
  ;
  cin >> str;
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    string buf = str.substr(l, r - l + 1);
    int cr = 0;
    int dr = 2;
    int a[11] = {0};
    bool fl = false;
    int prv = -1;
    while (1) {
      if (cr < 0 || cr >= buf.length()) break;
      if (buf[cr] >= '0' && buf[cr] <= '9') {
        a[buf[cr] - '0']++;
        buf[cr] = char(int(buf[cr] - 1));
        prv = cr;
        fl = false;
      } else if (buf[cr] == '<') {
        dr = 1;
        if (fl) buf[prv] = char('0' - 1);
        fl = true;
        prv = cr;
      } else if (buf[cr] == '>') {
        dr = 2;
        if (fl) buf[prv] = char('0' - 1);
        fl = true;
        prv = cr;
      }
      if (dr == 2)
        cr++;
      else
        cr--;
    }
    for (int i = 0; i < 10; i++) cout << a[i] << " ";
    cout << endl;
  }
  return 0;
}
