#include <bits/stdc++.h>
int x[10];
int cp, dp;
using namespace std;
void print() {
  for (int i = 0; i < 10; ++i) {
    cout << x[i];
    if (i == 9)
      cout << "\n";
    else
      cout << " ";
  }
}
int pp(char a, int &dp) {
  if (a == '<') {
    dp = -1;
    return -2;
  } else if (a == '>') {
    dp = 1;
    return -2;
  } else
    return a - '0';
}
void work(int l, int r, string ch1) {
  cp = l;
  dp = 1;
  int temp;
  bool ins = true;
  while (cp >= l && cp <= r) {
    temp = pp(ch1[cp], dp);
    if (temp >= 0) {
      x[temp]++;
      ch1[cp]--;
      cp += dp;
    } else {
      if (temp == -1) cp += dp;
      if (temp == -2) {
        int cpt = cp;
        cp += dp;
        if (cp < l || cp > r) break;
        int temp1 = pp(ch1[cp], dp);
        while (temp1 == -1) {
          cp += dp;
          temp1 = pp(ch1[cp], dp);
        }
        if (cp < l || cp > r) break;
        if (temp1 == -2) ch1[cpt] = '0' - 1;
        if (temp1 >= 0) x[temp1]++, ch1[cp]--, cp += dp;
      }
    }
  }
  print();
}
int main() {
  int n, q;
  string ch;
  cin >> n >> q;
  cin >> ch;
  for (int i = 0; i < q; ++i) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    memset(x, 0, sizeof(x));
    if (l == r) {
      int pk = ch[l];
      if (pk == '<' || pk == '>')
        print();
      else
        x[pk - '0']++, print();
    } else
      work(l, r, ch);
  }
  return 0;
}
