#include <bits/stdc++.h>
using namespace std;
char w[109], tm[109];
int ans[11];
int main() {
  int l, r, n, m, i, j;
  while (~scanf("%d%d", &n, &m)) {
    scanf("%s", w);
    int len = strlen(w);
    while (m--) {
      scanf("%d%d", &l, &r);
      l--, r--;
      memcpy(tm, w, sizeof(tm));
      memset(ans, 0, sizeof(ans));
      int d = 1, pre = -1;
      i = l;
      while (i >= l && i <= r) {
        if (tm[i] >= '0' && tm[i] <= '9') {
          ans[tm[i] - '0']++;
          if (tm[i] == '0')
            tm[i] = 0;
          else
            tm[i]--;
          pre = i;
          i += d;
        } else if (tm[i] == '<' || tm[i] == '>') {
          if (pre != -1 && (tm[pre] == '<' || tm[pre] == '>')) tm[pre] = 0;
          pre = i;
          if (tm[i] == '<')
            d = -1, i--;
          else
            d = 1, i++;
        } else {
          i += d;
        }
      }
      for (i = 0; i < 10; i++) {
        if (i) printf(" ");
        printf("%d", ans[i]);
      }
      puts("");
    }
  }
}
