#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string x;
  cin >> x;
  while (q--) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    char cp;
    int dp = 1;
    vector<int> s(11, 0);
    string cur = x;
    vector<bool> okay(n + 100, 1);
    int i = l;
    while (i >= l and i <= r) {
      if (isdigit(cur[i])) {
        s[cur[i] - '0']++;
        if (cur[i] != '0')
          cur[i] = ((cur[i] - '0') - 1) + '0';
        else if (cur[i] == '0')
          okay[i] = 0;
        if (dp == 1) {
          do {
            i++;
            if (i > r) break;
          } while (okay[i] == 0);
        } else if (dp == 0) {
          do {
            i--;
            if (i <= -1) break;
          } while (okay[i] == 0);
        }
      } else {
        if (cur[i] == '<') {
          int old = i;
          do {
            i--;
            if (i <= -1) break;
          } while (okay[i] == 0);
          if (i < l) break;
          if ((cur[i] == '>' or cur[i] == '<')) okay[old] = 0;
          dp = 0;
        } else if (cur[i] == '>') {
          int old = i;
          do {
            i++;
            if (i >= n) break;
          } while (okay[i] == 0);
          if (i > r) break;
          if ((cur[i] == '>' or cur[i] == '<')) okay[old] = 0;
          dp = 1;
        }
      }
    }
    for (int i = 0; i < 10; i++) {
      cout << s[i] << ' ';
    }
    puts("");
  }
}
