#include <bits/stdc++.h>
using namespace std;
int n, q, a[10];
int main() {
  string s;
  cin >> n >> q >> s;
  while (q--) {
    string m = s;
    for (int i = 0; i < 10; ++i) a[i] = 0;
    int l, r;
    cin >> l >> r;
    bool ok = 0;
    int prev, x = 1;
    for (int d = l - 1; d >= l - 1 && d <= r - 1; d += x)
      if (m[d] >= '0' && m[d] <= '9')
        a[m[d] - '0']++, m[d]--, ok = 0, prev = d;
      else if (m[d] == '>') {
        if (ok) m[prev] = 0;
        x = 1, ok = 1, prev = d;
      } else if (m[d] == '<') {
        if (ok) m[prev] = 0;
        x = -1, ok = 1, prev = d;
      }
    for (int j = 0; j < 10; ++j) cout << a[j] << ' ';
    cout << '\n';
  }
}
