#include <bits/stdc++.h>
using namespace std;
int cnt[102][10];
int main() {
  int n, q, l, r;
  string str;
  cin >> n >> q;
  cin >> str;
  for (int i = 0; i < q; i++) {
    cin >> l >> r;
    l--;
    r--;
    string s = str;
    int cp = l, dp = 1;
    while (cp >= l && cp <= r) {
      if (isdigit(s[cp])) {
        cnt[i][s[cp] - '0']++;
        if (s[cp] > '0') {
          s[cp]--;
          cp += dp;
        } else {
          s.erase(cp, 1);
          r--;
          if (dp == -1) {
            cp--;
          }
        }
      } else {
        dp = (s[cp] == '>') ? 1 : -1;
        cp += dp;
        if (cp >= l && cp <= r) {
          if (!isdigit(s[cp]) && dp == 1) {
            s.erase(cp - 1, 1);
            r--;
            cp--;
          } else if (!isdigit(s[cp])) {
            s.erase(cp + 1, 1);
            r--;
          }
        }
      }
    }
    for (int j = 0; j < 10; j++) {
      cout << cnt[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
