#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, q, cp = 0, dp = 1;
  cin >> n >> q;
  string s, temp;
  cin >> temp;
  while (q--) {
    s = temp;
    long long int l, r;
    cin >> l >> r;
    l--;
    r--;
    cp = l;
    dp = 1;
    vector<long long int> ct(10, 0);
    char prev = '*';
    while (cp >= l && cp <= r) {
      if (s[cp] == '0') {
        ct[s[cp] - 48]++;
        s.erase(s.begin() + cp);
        r--;
        if (dp == -1) cp += dp;
        prev = 0;
      } else if (s[cp] > '0' && s[cp] <= '9') {
        ct[s[cp] - 48]++;
        s[cp]--;
        cp += dp;
        prev = 0;
      } else if (s[cp] == '>') {
        if (prev == '>' || prev == '<') {
          s.erase(s.begin() + cp - dp);
          r--;
        }
        dp = 1;
        if (prev != '>') cp += dp;
        prev = '>';
      } else if (s[cp] == '<') {
        if (prev == '<' || prev == '>') {
          s.erase(s.begin() + cp - dp);
          r--;
        }
        dp = -1;
        cp += dp;
        if (prev == '>') cp -= 1;
        prev = '<';
      }
    }
    for (long long int i = 0; i < ct.size(); i++) cout << ct[i] << " ";
    cout << endl;
    s.clear();
    ct.clear();
  }
  return 0;
}
