#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  char c;
  vector<int> my(s.size());
  for (int i = 0; i < s.size(); i++) {
    c = s[i];
    if (s[i] == '>')
      my[i] = 10;
    else if (s[i] == '<')
      my[i] = 11;
    else
      my[i] = atoi(&(c));
  }
  long long int l, r;
  long long int id, to;
  for (int i = 0; i < q; i++) {
    cin >> l >> r;
    l--;
    r--;
    vector<int> go(10, 0);
    vector<int> del(s.size(), 0);
    vector<int> temp = my;
    to = 1;
    id = l;
    int mode = 0;
    int pre;
    while (id >= l && id <= r) {
      if (del[id] == 1) {
        id += to;
        continue;
      };
      if (temp[id] < 10) {
        go[temp[id]]++;
        temp[id]--;
        if (temp[id] == -1) del[id] = 1;
        mode = 0;
      } else {
        if (mode == 1) {
          del[pre] = 1;
        }
        mode = 1;
        if (temp[id] == 10) {
          to = 1;
        } else
          to = -1;
        pre = id;
      }
      id += to;
    }
    for (int j = 0; j < 10; j++) {
      cout << go[j] << " ";
    }
    cout << endl;
  }
}
