#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  char s[105];
  scanf("%d%d", &n, &q);
  scanf("%s", s + 1);
  while (q--) {
    int l, r;
    scanf("%d%d", &l, &r);
    char str[105];
    int cnt[10] = {0};
    bool vist[105];
    memset(vist, 0, sizeof(vist));
    for (int i = (l); i <= (r); i++) str[i] = s[i];
    int pos = -1;
    int dp = 1;
    for (int i = l; i <= r && i >= l; i += dp) {
      if (vist[i]) continue;
      if (str[i] >= '0' && str[i] <= '9') {
        pos = -1;
        cnt[str[i] - '0']++;
        if (str[i] == '0') {
          vist[i] = 1;
          continue;
        }
        str[i]--;
      } else {
        if (pos != -1) vist[pos] = 1;
        pos = i;
        if (str[i] == '>')
          dp = 1;
        else
          dp = -1;
      }
    }
    for (int i = 0; i < (10); i++) printf("%d ", cnt[i]);
    puts("");
  }
  return 0;
}
