#include <bits/stdc++.h>
using namespace std;
int ans[15];
int n, q;
string in;
string tmp;
void go(int l, int r) {
  tmp = " " + in.substr(l - 1, r - l + 1);
  string::iterator cp = tmp.begin() + 1;
  int dp = 1;
  while (cp != tmp.begin() && cp != tmp.end()) {
    if (*cp >= '0' && *cp <= '9') {
      ans[*cp - '0']++;
      *cp -= 1;
      if (*cp == '0' - 1) {
        tmp.erase(cp);
        if (dp == -1) cp--;
      } else
        cp += dp;
    } else {
      if (*cp == '<')
        dp = -1;
      else
        dp = 1;
      if (*(cp + dp) == '<' || *(cp + dp) == '>') {
        tmp.erase(cp);
        if (dp == -1) cp--;
      } else
        cp = cp + dp;
    }
  }
}
int main() {
  scanf("%d %d", &n, &q);
  cin >> in;
  for (int tt = 0; tt < q; tt++) {
    int l, r;
    memset(ans, 0, sizeof(ans));
    scanf("%d %d", &l, &r);
    go(l, r);
    for (int i = 0; i < 10; i++) printf("%d ", ans[i]);
    printf("\n");
  }
  return 0;
}
