1. Abridged Problem Statement
Given a lowercase string s (length up to 14, at most 10 distinct letters), each distinct-letter mapping to distinct digits (0-9) without leading zero yields an integer. Find all positive integers d such that every valid mapped integer is divisible by d. Output those divisors in increasing order.

2. Detailed Editorial

Goal
We want the greatest-common-divisor G of the set S = {N(phi) | phi: letters->distinct digits, phi(s[0])!=0}, then list all positive divisors of G.

Key observations
If we assign each letter c a weight
  mask[c] = sum of 10^(position of c in s), with the leftmost digit highest power,
then for a mapping phi the resulting number is
  N(phi) = sum_{c} mask[c] * phi(c).

We seek G = gcd { N(phi) } over all valid phi.

The solution uses two complementary techniques to build G:

First, backtracking enumerates a bounded number (up to 200) of valid letter-to-digit assignments (distinct digits, no leading zero) and folds each resulting number directly into g via gcd.

Second, we use the place-value masks: swapping the digits assigned to two letters x and y changes the produced number by
  (mask_x + mask_y) * (phi(x) - phi(y)).
For every admissible pair of letters and nearby digit values (respecting distinctness and the no-leading-zero constraint), this difference is folded into g. Because (phi(x) - phi(y)) can be +-1 or +-2, G must divide (mask_x + mask_y) for every pair x,y. Together with the directly sampled values, g converges to the true GCD.

Algorithm
1. Read s.
2. Compute mask[c] for each distinct letter by walking s right-to-left with successive powers of 10.
3. Run backtracking to enumerate up to 200 valid numbers, folding each into g.
4. For every ordered pair (x,y) of distinct letters and every pair of nearby digit values (x_val, y_val) (|x_val - y_val| <= 1, no leading zero), fold mask_x*(x_val - y_val) + mask_y*(y_val - x_val) = (mask_x + mask_y)*(x_val - y_val) into g.
5. Factorize g by trial division and generate all its divisors.
6. Sort and print them.

Time complexity
- Computing masks: O(|s|).
- Backtracking over at most 200 steps: fast in practice.
- Pair-difference gcd: O(100 log M).
- Factorization of G up to ~10^14: trial division is sufficient given the small number produced.
- Enumerating divisors from prime powers: typically small count.

3. C++ Solution

```cpp
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

string s;

void read() { cin >> s; }

void backtracking(
    vector<int>& mapping, int64_t& g, int digit_mask, int pos, int64_t curr,
    int& steps
) {
    if(g == 1 || steps <= 0) {
        return;
    }

    if(pos == s.size()) {
        g = gcd(g, curr);
        steps--;
        return;
    }

    int c = s[pos] - 'a';
    if(mapping[c] != -1) {
        backtracking(
            mapping, g, digit_mask, pos + 1, curr * 10 + mapping[c], steps
        );
    } else {
        for(int d = (pos == 0); d < 10; d++) {
            if(digit_mask & (1 << d)) {
                continue;
            }
            mapping[c] = d;
            backtracking(
                mapping, g, digit_mask | (1 << d), pos + 1, curr * 10 + d, steps
            );
            mapping[c] = -1;
        }
    }
}

void solve() {
    // A common divisor must divide every number the pattern can produce. We
    // collect a g = gcd of several producible numbers and reasonable
    // differences between them, then output all divisors of g.
    //
    // First, backtracking enumerates up to a few hundred valid letter-to-digit
    // assignments (distinct digits, no leading zero) and folds each resulting
    // number into g. Then we use the place-value mask of each letter: masks[c]
    // is the sum of powers of ten over the positions where c occurs. Swapping
    // the digits of two letters x and y keeps the value producible but changes
    // it by (mask_x + mask_y) * (y - x); the gcd is unchanged by adding such a
    // difference, so for every admissible pair of letters and nearby digit
    // values (respecting distinctness and the no-leading-zero rule) we fold
    // that difference into g as well. Finally g is fully factorised and all of
    // its divisors are generated and printed in increasing order.

    int n = s.size();
    vector<int> mapping(26, -1);
    int64_t g = 0;
    int steps = 200;
    backtracking(mapping, g, 0, 0, 0, steps);

    map<char, int64_t> masks;
    int64_t mask = 1;
    for(int i = n - 1; i >= 0; i--) {
        masks[s[i]] += mask;
        mask = mask * 10;
    }

    for(auto [xl, mask_x]: masks) {
        for(auto [yl, mask_y]: masks) {
            for(int x = 0; x < 10; x++) {
                for(int y = max(x - 1, 0); y < min(x + 2, 10); y++) {
                    if(xl == yl || x == y || (xl == s[0] && x == 0) ||
                       (yl == s[0] && y == 0) || (xl == s[0] && y == 0) ||
                       (yl == s[0] && x == 0)) {
                        continue;
                    }
                    g =
                        gcd(g, -mask_x * (int64_t)(x - y) -
                                   mask_y * (int64_t)(y - x));
                }
            }
        }
    }

    assert(g > 0);

    vector<pair<int64_t, int>> prime_divs;
    for(int64_t x = 2; x * x <= g; x++) {
        if(g % x != 0) {
            continue;
        }

        int cnt = 0;
        while(g % x == 0) {
            cnt++;
            g /= x;
        }
        prime_divs.push_back({x, cnt});
    }

    if(g > 1) {
        prime_divs.push_back({g, 1});
    }

    vector<int64_t> all_divs = {1};
    for(auto [x, cnt]: prime_divs) {
        int sz = all_divs.size();
        for(int i = 0; i < sz; i++) {
            int64_t y = all_divs[i];
            for(int j = 1; j <= cnt; j++) {
                all_divs.push_back(y * x);
                y *= x;
            }
        }
    }

    sort(all_divs.begin(), all_divs.end());
    cout << all_divs << '\n';
}

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

    int T = 1;
    cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        cout << "Case " << test << ": ";
        solve();
    }

    return 0;
}
```

4. Python Solution

```python
import sys, threading
def main():
    import math
    sys.setrecursionlimit(10**7)
    T = int(sys.stdin.readline())
    for tc in range(1, T+1):
        s = sys.stdin.readline().strip()
        n = len(s)

        # Compute weight mask for each letter: sum of 10^(position)
        mask = {}
        place = 1
        # iterate from least significant digit (rightmost) back to left
        for i in range(n-1, -1, -1):
            c = s[i]
            mask[c] = mask.get(c, 0) + place
            place *= 10

        letters = list(mask.items())  # list of (char, weight)
        m = len(letters)

        # Compute G
        if m == 1:
            # Only one letter: G = mask * gcd(notes 1..9) = mask
            G = letters[0][1]
        else:
            G = 0
            # gcd over all sums mask[c]+mask[d]
            for i in range(m):
                for j in range(i+1, m):
                    wsum = letters[i][1] + letters[j][1]
                    G = math.gcd(G, wsum)

        # Now factor G to get divisors
        # For G up to ~1e14, trial division up to sqrt is feasible in Python
        # since G is special (sum of few powers of 10) and small prime count.
        fac = []
        tmp = G
        # trial divide by small primes
        f = 2
        while f*f <= tmp:
            if tmp % f == 0:
                cnt = 0
                while tmp % f == 0:
                    tmp //= f
                    cnt += 1
                fac.append((f, cnt))
            f += 1 if f==2 else 2  # skip even numbers after 2
        if tmp > 1:
            fac.append((tmp, 1))

        # Generate all divisors from prime factorization
        divisors = [1]
        for (p, cnt) in fac:
            cur = []
            # for each existing divisor d, multiply by p^e for e in [1..cnt]
            for d in divisors:
                val = d
                for _ in range(cnt):
                    val *= p
                    cur.append(val)
            divisors += cur

        divisors.sort()
        # Output
        print("Case {}: {}".format(tc, " ".join(str(d) for d in divisors)))

if __name__ == "__main__":
    main()
```

5. Compressed Editorial
- Build weight for each letter: mask[c] = sum of 10^(position) over each occurrence.
- Enumerate a bounded number of valid mappings via backtracking and fold the resulting numbers into g via gcd.
- For every pair of distinct letters and nearby digit values, fold the resulting difference (mask_x + mask_y)*(x_val - y_val) into g as well.
- The combined g equals the true GCD of all producible numbers.
- Factorize g and list all its divisors in ascending order.
