#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const double EPS = 1e-7;
long long mod = 1000000009;
long long modpow(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 1) return (modpow(a, b - 1) * a) % mod;
  long long q = modpow(a, b / 2);
  return (q * q) % mod;
}
string s;
int cant[10];
void run(int l, int r) {
  string cur = s;
  memset(cant, 0, sizeof(cant));
  int dp = 1;
  int cp = l;
  int last = -1;
  while (cp >= l && cp <= r) {
    if (cur[cp] != 0) {
      if (cur[cp] != '<' && cur[cp] != '>') {
        int d = cur[cp] - '0';
        cant[d]++;
        if (d == 0)
          cur[cp] = 0;
        else
          cur[cp] = d - 1 + '0';
        last = -1;
      } else {
        if (last != -1) cur[last] = 0;
        if ((dp == 1 && cur[cp] == '<') || (dp == -1 && cur[cp] == '>'))
          dp *= -1;
        last = cp;
      }
    }
    cp += dp;
  }
  for (int i = 0; i < 10; i++) cout << cant[i] << " ";
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  cin >> s;
  for (int i = 0; i < q; i++) {
    int l, r;
    cin >> l >> r;
    run(l - 1, r - 1);
  }
  return 0;
}
