#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101;
int N, Q, freq[11];
char commands[MAXN], commands2[MAXN];
void solve(int l, int r) {
  l--;
  r--;
  for (int i = 0; i < N; i++) commands2[i] = commands[i];
  for (int i = 0; i < 10; i++) freq[i] = 0;
  int cur = l;
  int dir = 1;
  int prev;
  while (cur >= l && cur <= r) {
    if (commands2[cur] == 0)
      cur += dir;
    else if (commands2[cur] == '>') {
      prev = cur;
      dir = 1;
      cur += dir;
      while (cur >= l && cur <= r && commands2[cur] == 0) cur += dir;
      if (cur < l || cur > r) break;
      if (commands2[cur] == '<' || commands2[cur] == '>') commands2[prev] = 0;
    } else if (commands2[cur] == '<') {
      prev = cur;
      dir = -1;
      cur += dir;
      while (cur >= l && cur <= r && commands2[cur] == 0) cur += dir;
      if (cur < l || cur > r) break;
      if (commands2[cur] == '<' || commands2[cur] == '>') commands2[prev] = 0;
    } else {
      freq[commands2[cur] - '0']++;
      commands2[cur]--;
      if (commands2[cur] < '0') commands2[cur] = 0;
      cur += dir;
    }
  }
  for (int i = 0; i < 10; i++) {
    printf("%d", freq[i]);
    if (i == 9)
      printf("\n");
    else
      printf(" ");
  }
}
int main() {
  scanf("%d %d", &N, &Q);
  scanf("%s", commands);
  for (int i = 0; i < Q; i++) {
    int L, R;
    scanf("%d %d", &L, &R);
    solve(L, R);
  }
  return 0;
}
