#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 10;
int n, q, l, r, a[N][2], cp, dp, num;
int tot[10];
string s, s1;
void get_next() {
  int ll = a[cp][0], rr = a[cp][1], tcp = cp;
  if (s1[cp] >= '0' && s1[cp] <= '9') {
    cp = a[cp][dp];
    num++;
    tot[s1[tcp] - '0']++;
    s1[tcp]--;
    if (s1[tcp] < '0') {
      a[ll][1] = rr;
      a[rr][0] = ll;
    }
  } else {
    if (s1[cp] == '<')
      dp = 0;
    else
      dp = 1;
    cp = a[cp][dp];
    if (cp < l || cp > r) return;
    if (s1[cp] >= '0' && s1[cp] <= '9') return;
    a[ll][1] = rr, a[rr][0] = ll;
  }
}
int main() {
  cin >> n >> q;
  cin >> s;
  s = ' ' + s;
  for (int i = 1; i <= q; i++) {
    num = 0;
    s1 = s;
    cin >> l >> r;
    for (int j = l; j <= r; j++) a[j][0] = j - 1, a[j][1] = j + 1;
    for (int j = 0; j <= 9; j++) tot[j] = 0;
    cp = l, dp = 1;
    while (1) {
      get_next();
      if (cp < l || cp > r) break;
    }
    for (int j = 0; j <= 9; j++) cout << tot[j] << ' ';
    cout << endl;
  }
  return 0;
}
