#include <bits/stdc++.h>
using namespace std;
bool isok(string s) {
  for (int i = 1; i < s.length(); i++)
    if (s.at(i) != s.at(0)) return 0;
  return 1;
}
int main() {
  int p, l, r, n, q, dir, mark;
  string lcm, s;
  int cnt[10];
  cin >> n >> q;
  cin >> s;
  if (isok(s)) {
    while (q--) {
      memset(cnt, 0, sizeof(cnt));
      scanf("%d%d", &l, &r);
      cnt[s.at(0) - '0'] = r - l + 1;
      for (int i = 0; i <= 9; i++) printf("%d ", cnt[i]);
      printf("\n");
    }
  } else {
    while (q--) {
      scanf("%d%d", &l, &r);
      l--;
      r--;
      lcm = s.substr(l, r - l + 1);
      p = 0;
      mark = 0;
      dir = 1;
      memset(cnt, 0, sizeof(cnt));
      while (p >= 0 && p < lcm.length()) {
        if (lcm.at(p) >= '0' && lcm.at(p) <= '9') {
          if (mark) mark = 0;
          cnt[lcm.at(p) - '0']++;
          if (lcm.at(p) == '0') {
            lcm.erase(p, 1);
            if (dir == 1) p--;
          } else
            lcm.at(p)--;
          p += dir;
        } else {
          if (mark) {
            lcm.erase(p - dir, 1);
            if (p - dir < p) p--;
          }
          if (lcm.at(p) == '>')
            dir = 1;
          else
            dir = -1;
          mark = 1;
          p += dir;
        }
      }
      for (int i = 0; i <= 9; i++) printf("%d ", cnt[i]);
      printf("\n");
    }
  }
  return 0;
}
