#include <bits/stdc++.h>
using namespace std;
void interpreter(int& CP, char& DP, string& sub_sequence, int freq[]) {
  char _cp = sub_sequence[CP];
  if (_cp != '<' && _cp != '>') {
    if (_cp != '0') {
      freq[_cp - '0']++;
      sub_sequence[CP]--;
    } else {
      freq[_cp - '0']++;
      sub_sequence.erase(CP, 1);
      if (DP == '>') return;
    }
  } else {
    DP = sub_sequence[CP];
    if (DP == '>') {
      if (CP + 1 < sub_sequence.size()) {
        if (sub_sequence[CP + 1] == '>' || sub_sequence[CP + 1] == '<') {
          sub_sequence.erase(CP, 1);
          return;
        }
      }
    } else {
      if (CP - 1 >= 0) {
        if (sub_sequence[CP - 1] == '>' || sub_sequence[CP - 1] == '<') {
          sub_sequence.erase(CP, 1);
        }
      }
    }
  }
  if (DP == '>')
    CP++;
  else
    CP--;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, q;
  cin >> n >> q;
  string sequence;
  cin >> sequence;
  for (int i = 0; i < q; i++) {
    int freq[10];
    for (auto& e : freq) e = 0;
    int l, r;
    cin >> l >> r;
    l--, r--;
    string sub_sequence = sequence.substr(l, r - l + 1);
    int CP = 0;
    char DP = '>';
    while (CP >= 0, CP < sub_sequence.size()) {
      interpreter(CP, DP, sub_sequence, freq);
    }
    for (auto& e : freq) {
      cout << e << " ";
    }
    cout << endl;
  }
}
