#include <bits/stdc++.h>
using namespace std;
void move(char b[], int n, int i) {
  for (int j = i; j < n - 1; ++j) {
    b[j] = b[j + 1];
  }
}
int main() {
  int a[10];
  char b[101];
  char d[101];
  int c;
  int n, q, nd, nn;
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  for (int i = 0; i < q; ++i) {
    for (int j = 0; j < 10; ++j) a[j] = 0;
    int l, r;
    cin >> l >> r;
    nn = 0;
    for (int j = l - 1; j < r; ++j) {
      d[j - (l - 1)] = b[j];
      if (d[j - (l - 1)] >= '0' && d[j - (l - 1)] <= '9') ++nn;
    }
    nd = r - l + 1;
    int cp = 0;
    char dp = '>';
    while (1) {
      if (nn <= 0 || cp < 0 || cp >= nd) {
        break;
      }
      if (d[cp] == '<') {
        dp = '<';
        if (cp == 0) {
          break;
        }
        if (d[cp - 1] == '>' || d[cp - 1] == '<') {
          move(d, nd, cp);
          --nd;
        }
      } else if (d[cp] == '>') {
        dp = '>';
        if (cp == nd - 1) {
          break;
        }
        if (d[cp + 1] == '>' || d[cp + 1] == '<') {
          move(d, nd, cp);
          --cp;
          --nd;
        }
      } else if (d[cp] >= '1' && d[cp] <= '9') {
        ++a[d[cp] - '0'];
        --d[cp];
      } else if (d[cp] == '0') {
        ++a[0];
        move(d, nd, cp);
        if (dp == '>') {
          --cp;
        }
        --nn;
        --nd;
      }
      if (dp == '<') {
        --cp;
      } else {
        ++cp;
      }
    }
    for (int j = 0; j < 9; ++j) {
      cout << a[j] << " ";
    }
    cout << a[9] << endl;
  }
  return 0;
}
