#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string p;
  cin >> p;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    bool f[105] = {};
    string t = p;
    int g[11] = {};
    int a = x;
    bool z = 0;
    bool w = 0;
    int b;
    while (1) {
      if (a < x || a > y) break;
      if (w && (t[a] == '>' || t[a] == '<')) {
        f[b] = 1;
      }
      if (t[a] == '>' || t[a] == '<') w = 1;
      if (t[a] == '>') {
        z = 0;
      } else if (t[a] == '<') {
        z = 1;
      } else {
        w = 0;
        g[t[a] - '0']++;
        if (t[a] > '0')
          t[a]--;
        else
          f[a] = 1;
      }
      b = a;
      if (!z)
        while (1) {
          a++;
          if (!f[a]) break;
        }
      else {
        while (1) {
          a--;
          if (a < 0 || !f[a]) break;
        }
      }
    }
    for (int j = 0; j < 10; j++) {
      cout << g[j] << " ";
    }
    cout << endl;
  }
  return 0;
}
