#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
template <typename T>
inline T Abs(T x) {
  return (x >= 0) ? x : -x;
}
template <typename T>
inline T sqr(T x) {
  return x * x;
}
template <typename T>
string toStr(T x) {
  stringstream st;
  st << x;
  string s;
  st >> s;
  return s;
}
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = 3.1415926535897932384626433832795;
const int MAXN = 100100;
bool good(const string &s, int v) { return 0 <= v && v < (int)s.size(); }
void solve(string s) {
  int v = 0, dir = 1;
  vector<int> ans(10, 0);
  while (good(s, v)) {
    int u = v;
    if (isdigit(s[u])) {
      ans[s[u] - '0']++;
      s[u]--;
      v += dir;
      if (!isdigit(s[u])) {
        if (dir == +1) v--;
        s.erase(u, 1);
      }
    } else {
      dir = (s[u] == '>') ? +1 : -1;
      v += dir;
      if (!isdigit(s[v])) {
        if (dir == +1) v--;
        s.erase(u, 1);
      }
    }
  }
  for (int i = 0; i < (int)(ans.size()); i++) cout << ans[i] << " ";
  cout << endl;
}
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  for (int i = 0; i < (int)(q); i++) {
    int l, r;
    cin >> l >> r;
    solve(s.substr(l - 1, r - l + 1));
  }
  return 0;
}
