#include <bits/stdc++.h>
using namespace std;
int n, q, l, r;
string s;
int main() {
  cin >> n >> q >> s;
  for (int i = 1; i <= q; i++) {
    cin >> l >> r;
    --l;
    --r;
    int was[20], cp, dp = 1;
    string t = s;
    memset(was, 0, sizeof(was));
    cp = l;
    while (cp >= l && cp <= r) {
      if (t[cp] == '>' || t[cp] == '<') {
        int pr = cp;
        if (t[cp] == '>')
          dp = 1;
        else
          dp = -1;
        cp += dp;
        while (cp >= l && cp <= r && t[cp] == 1) cp += dp;
        if (cp < l || cp > r) break;
        if (t[cp] == '>' || t[cp] == '<') t[pr] = 1;
        continue;
      };
      was[t[cp] - '0']++;
      t[cp]--;
      if (t[cp] < '0') t[cp] = 1;
      cp += dp;
      while (cp >= l && cp <= r && t[cp] == 1) cp += dp;
    };
    for (int j = 0; j < 10; j++) printf("%d ", was[j]);
    printf("\n");
  }
  return 0;
}
