#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  map<char, int> ans;
  string s;
  cin >> n >> q;
  cin >> s;
  while (q--) {
    ans.clear();
    int l, r;
    cin >> l >> r;
    string a = s.substr(l - 1, r - l + 1);
    int index = 0;
    char dista = '>';
    while (!(index >= a.size() || index < 0)) {
      char c = a[index];
      if (c <= '9' && c >= '0') {
        ans[c]++;
        if (a[index] == '0') {
          a.erase(a.begin() + index);
          r--;
          if (dista == '>') index--;
        } else
          a[index]--;
      } else {
        dista = c;
      }
      if (dista == '>')
        index++;
      else
        index--;
      if (index >= a.size() || index < 0) break;
      if ((a[index] == '>' || a[index] == '<') && (c == '>' || c == '<')) {
        if (dista == '>') {
          a.erase(a.begin() + index - 1);
          index--;
        } else
          a.erase(a.begin() + index + 1);
      }
    }
    for (int i = 0; i <= 9; i++) {
      char c = '0' + i;
      if (i != 0) cout << " ";
      cout << ans[c];
    }
    cout << endl;
  }
  return 0;
}
