#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, q;
  cin >> n >> q;
  string temp;
  cin >> temp;
  string s = temp;
  while (q--) {
    int l, r;
    cin >> l >> r;
    s = s.substr(l - 1, r - l + 1);
    int cp = 0, dp = 1;
    int out[10] = {0};
    while (0 <= cp && cp < s.length()) {
      bool erase = false;
      if ('0' <= s[cp] && s[cp] <= '9') {
        out[s[cp] - '0']++;
        s[cp]--;
        if (s[cp] < '0') erase = true;
      } else {
        if (s[cp] == '<')
          dp = -1;
        else
          dp = 1;
        if (cp + dp >= 0 && cp + dp < s.length() &&
            (s[cp + dp] == '<' || s[cp + dp] == '>'))
          erase = true;
      }
      if (erase) {
        s.erase(cp, 1);
        if (dp == -1) cp--;
      } else
        cp += dp;
    }
    for (int i = 0; i < 10; i++) cout << out[i] << " ";
    cout << endl;
    s = temp;
  }
  return 0;
}
