#include <bits/stdc++.h>
using namespace std;
struct node {
  char c;
  struct node* left;
  struct node* right;
};
int main(void) {
  struct node* root = NULL;
  struct node* temp = NULL;
  struct node* cur = NULL;
  int dp;
  struct node* cp;
  struct node* prev;
  char p;
  int n, q, i, j;
  int x[10];
  for (i = 0; i < 10; i++) x[i] = 0;
  char C[110];
  scanf("%d %d", &n, &q);
  cin.get();
  cin.getline(C, 105);
  root = (struct node*)malloc(sizeof(struct node));
  root->c = C[0];
  root->left = NULL;
  root->right = NULL;
  cur = root;
  for (i = 1; i < n; i++) {
    temp = (struct node*)malloc(sizeof(struct node));
    temp->c = C[i];
    cur->right = temp;
    temp->left = cur;
    temp->right = NULL;
    cur = temp;
  }
  struct node* root1;
  int l, r;
  for (i = 0; i < q; i++) {
    scanf("%d %d", &l, &r);
    root1 = (struct node*)malloc(sizeof(struct node));
    root1 = (struct node*)malloc(sizeof(struct node));
    root1->c = C[l - 1];
    root1->left = NULL;
    root1->right = NULL;
    cur = root1;
    for (j = l; j < r; j++) {
      temp = (struct node*)malloc(sizeof(struct node));
      temp->c = C[j];
      cur->right = temp;
      temp->left = cur;
      temp->right = NULL;
      cur = temp;
    }
    for (j = 0; j < 10; j++) x[j] = 0;
    dp = 1;
    prev = NULL;
    temp = (struct node*)malloc(sizeof(struct node));
    temp->c = 'e';
    temp->right = root1;
    temp->left = NULL;
    root1->left = temp;
    temp = (struct node*)malloc(sizeof(struct node));
    temp->c = 'e';
    temp->left = cur;
    cur->right = temp;
    temp->right = NULL;
    cp = root1;
    while (cp->c != 'e') {
      p = cp->c;
      if (p <= '9' && p >= '0') {
        x[p - '0']++;
        cp->c--;
        if (dp > 0) {
          cp = cp->right;
          prev = cp->left;
        } else {
          cp = cp->left;
          prev = cp->right;
        }
        if (p == '0') {
          if (dp > 0) {
            cp->left = prev->left;
            prev->left->right = cp;
            free(prev);
          } else {
            cp->right = prev->right;
            prev->right->left = cp;
            free(prev);
          }
        }
      } else {
        if (prev != NULL && (prev->c == '>' || prev->c == '<')) {
          if (dp > 0) {
            cp->left = prev->left;
            prev->left->right = cp;
            free(prev);
          } else {
            cp->right = prev->right;
            prev->right->left = cp;
            free(prev);
          }
        }
        if (p == '>')
          dp = 1;
        else
          dp = -1;
        prev = cp;
        if (dp > 0)
          cp = cp->right;
        else
          cp = cp->left;
      }
    }
    for (j = 0; j < 10; j++) {
      if (j != 0) printf(" ");
      printf("%d", x[j]);
    }
    printf("\n");
    cur = root1->left;
    while (cur->right != NULL) {
      temp = cur;
      cur = cur->right;
      free(temp);
    }
    free(cur);
  }
  cur = root;
  while (cur->right != NULL) {
    temp = cur;
    cur = cur->right;
    free(temp);
  }
  free(cur);
  return 0;
}
