#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s, temp;
  cin >> s;
  int l, r;
  while (q--) {
    temp.clear();
    cin >> l >> r;
    for (int i = l - 1; i < r; i++) temp.push_back(s[i]);
    char prevd, d = '>';
    int arr[12] = {0};
    int i = 0;
    bool check = 0;
    int prev;
    while (i >= 0 && i < temp.size()) {
      if (temp[i] != '>' && temp[i] != '<') {
        arr[temp[i] - '0']++;
        temp[i]--;
        if (temp[i] < '0') {
          if (i == 0 && d == '<') break;
          if (i == temp.size() - 1 && d == '>') break;
          temp.erase(i, 1);
          if (d == '>') i--;
        }
      } else {
        d = temp[i];
        check = 1;
      }
      prev = i;
      prevd = d;
      if (d == '>')
        i++;
      else
        i--;
      if (temp[i] == '>' || temp[i] == '<') {
        if (check) {
          temp.erase(prev, 1);
          if (prevd == '>') i--;
        }
      }
      check = 0;
    }
    for (int i = 0; i < 10; i++) {
      if (i) cout << " ";
      cout << arr[i];
    }
    cout << endl;
  }
  return 0;
}
