#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string str;
    cin >> str;
    int niz[26] = {0};
    long long prod = 1.;

    for(int i = 0; i < str.size(); ++i) {
        niz[str[i] - 65]++;
        if(str[i] != 'Z') {
            if(niz[str[i] - 65 + 1] != 0) niz[str[i] - 65]--;
        }
    }

    for(int i = 0; i < 26; ++i) {
        //cout << char(65 + i) << " : " << niz[i] << endl;
        if(niz[i] == 0) {
            cout << 0;
            return 0;
        }
        if(niz[i] > 1) prod *= niz[i];
    }

    cout << prod%1000000007;

    return 0;
}