#include <bits/stdc++.h>
using namespace std;
int n, q;
vector<int> v[101][101];
string s, X;
bool isDigit(char d) { return '0' <= d && d <= '9'; }
bool isZero(char d) { return d == '0'; }
vector<int> solve(int L, int R) {
  vector<int> ans(10, 0);
  s = X;
  int l[100], r[100];
  for (int i = 0; i < 100; i++) {
    l[i] = i - 1;
    r[i] = i + 1;
  }
  int p = L, d = 1;
  while (L <= p && p <= R) {
    if (isDigit(s[p])) {
      if (isZero(s[p])) {
        ans[0]++;
        if (p > L) r[l[p]] = r[p];
        if (p < R) l[r[p]] = l[p];
      } else {
        ans[s[p] - '0']++;
        s[p]--;
      }
      if (d > 0)
        p = r[p];
      else
        p = l[p];
      continue;
    }
    if (s[p] == '>')
      d = 1;
    else
      d = -1;
    int np;
    if (d > 0)
      np = r[p];
    else
      np = l[p];
    if (np < L || np > R) break;
    if (!isDigit(s[np])) {
      if (p > L) r[l[p]] = r[p];
      if (p < R) l[r[p]] = l[p];
    }
    p = np;
  }
  return ans;
}
int main() {
  cin >> n >> q;
  cin >> X;
  for (int i = 0; i < (int)X.length(); i++)
    for (int j = i; j < (int)X.length(); j++) v[i][j] = solve(i, j);
  while (q--) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    for (int i = 0; i < 10; i++) cout << v[l][r][i] << " \n"[i + 1 == 10];
  }
  return 0;
}
