//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
  
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 2000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;

void prefix_function(string &s, vector<int> &p) {
    int n = sz(s);
    rep(i, 0, n) {
        int c = i - 1;
        while (c >= 0) {
            if (s[p[c]] == s[i]) {
                p[i] = p[c] + 1;
                break;
            }
            c = p[c] - 1;
        }
        if (c == -1) {
            p[i] = 0;
        }
    }
}

vector<ll> solve1(string s, ll x) {
    vector<ll> res(26, 0);
    rep(i, 0, sz(s)) {
        res[s[i] - 'a'] += x / sz(s);
    }
    rep(i, 0, x % sz(s)) {
        res[s[i] - 'a']++;
    }
    return res;
}

void solve(string s) {
    ll l, r;
    cin >> l >> r;
    vector<ll> a = solve1(s, r), b = solve1(s, l - 1);
    rep(i, 0, 26) {
        cout << a[i] - b[i] << " ";
    }
    cout << "\n";
}

string t1, t2;
vector<ll> c1(26, 0), c2(26, 0);
ll len[100], cnt1[100], cnt2[100];
vector<ll> ans;

void init(string &s, string &per) {
    t1 = s;
    t2 = s + per;
    rep(i, 0, sz(t1)) {
        c1[t1[i] - 'a']++;
    }
    rep(i, 0, sz(t2)) {
        c2[t2[i] - 'a']++;
    }
}

void rec(int p, ll x) {
    if (p == 0) {
        rep(i, 0, x) {
            ans[t1[i] - 'a']++;
        }
    } else if (p == 1) {
        rep(i, 0, x) {
            ans[t2[i] - 'a']++;
        }
    } else {
        if (x <= len[p - 1]) {
            rec(p - 1, x);
        } else {
            rep(i, 0, 26) {
                ans[i] += c1[i] * cnt1[p - 1] + c2[i] * cnt2[p - 1];
            }
            rec(p - 2, x - len[p - 1]);
        }
    }
}

vector<ll> solve2(ll x) {
    len[0] = sz(t1);
    cnt1[0] = 1;
    len[1] = sz(t2);
    cnt2[1] = 1;
    int p = 1;
    while (len[p] < x) {
        p++;
        len[p] = len[p - 1] + len[p - 2];
        cnt1[p] = cnt1[p - 1] + cnt1[p - 2];
        cnt2[p] = cnt2[p - 1] + cnt2[p - 2];
    }
    ans = vector<ll> (26, 0);
    rec(p, x);
    return ans;
}

void solve(string &s, string per) {
    init(s, per);
    ll l, r;
    cin >> l >> r;
    vector<ll> a = solve2(r), b = solve2(l - 1);
    rep(i, 0, 26) {
        cout << a[i] - b[i] << " ";
    }
    cout << "\n";
}

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    string s;
    cin >> s;
    vector<int> p1(sz(s));
    prefix_function(s, p1);
    int pos = sz(s) - 1;
    while (p1[pos] * 2 >= sz(s)) {
        pos = p1[pos] - 1;
    }
    s = s.substr(0, sz(s) - p1[pos]);
    vector<int> p(sz(s));
    prefix_function(s, p);
    /*for (int i : p) {
        cout << i << " ";
    }
    cout << endl;*/
    int n = sz(s);
    int per = n - p[n - 1];
    if (n % per == 0) {
        solve(s.substr(0, per));
    } else {
        solve(s, s.substr(0, per));
    }
    return 0;
}

Measured memory_bytes: 2768