1. Abridged Problem Statement  
Given a lowercase string s (length ≤ 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(φ) | φ: letters→distinct digits, φ(s[0])≠0}, then list all positive divisors of G.

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

We seek G = gcd { N(φ) } over all valid φ.  
Consider two mappings φ and ψ. The difference  
 N(φ) − N(ψ) = ∑ mask[c] (φ(c)−ψ(c)).  
By choosing ψ to fix all letters except a pair (x,y) where φ(x)=a, φ(y)=b, ψ(x)=b, ψ(y)=a (swap digits for just x,y), we get  
 N(φ)−N(ψ) = (a−b)*mask[x] + (b−a)*mask[y] = (a−b)*(mask[x]+mask[y]).  
Since (a−b) can be any nonzero integer in ±{1…9}, G must divide every (mask[x]+mask[y]). Hence  
 G = gcd_{x≠y} (mask[x] + mask[y]).  
Edge case: if there is only one distinct letter c, all numbers are φ(c)*mask[c] with φ(c)=1…9, so gcd({1…9})=1 times mask[c], i.e. G=mask[c].

Algorithm  
1. Read s.  
2. Compute mask[c] for each distinct letter.  
3. If only one letter: G = mask[c].  
   Else let G=0; for each unordered pair (c,d): G = gcd(G, mask[c]+mask[d]).  
4. Factorize G (e.g. trial division up to √G or Pollard’s rho) and generate all its divisors.  
5. Sort and print them.

Time complexity  
- Computing masks: O(|s|).  
- Pair gcd over ≤10 letters: O(100 log M).  
- Factorization of G up to ~10^14: use Pollard rho / Miller–Rabin in sub‐millisecond.  
- Enumerating divisors from prime powers: typically small count.

3. C++ Solution with Detailed Comments  

#include <bits/stdc++.h>  
using namespace std;

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

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

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

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

string s;

// Read one string pattern into global s
void read() {
    cin >> s;
}

// Compute gcd of two 64-bit ints
static int64_t gcd64(int64_t a, int64_t b) {
    while(b) {
        int64_t t = a % b;
        a = b;
        b = t;
    }
    return a;
}

void solve() {
    int n = (int)s.size();

    // Build weight mask for each of the 26 letters; initially zero
    // mask[c] = sum over positions where s[i]==c of 10^(n-1-i)
    map<char,int64_t> mask;
    int64_t place = 1;
    for(int i = n-1; i >= 0; i--) {
        mask[s[i]] += place;
        place *= 10;
    }

    // Extract all distinct letters
    vector<pair<char,int64_t>> letters;
    letters.reserve(mask.size());
    for(auto &p : mask) {
        letters.push_back(p);
    }

    int m = (int)letters.size();
    int64_t G = 0;

    if(m == 1) {
        // Only one distinct letter: gcd({d*mask}) = mask * gcd(1..9) = mask
        G = letters[0].second;
    } else {
        // Take gcd over all sums mask[x]+mask[y]
        for(int i = 0; i < m; i++) {
            for(int j = i+1; j < m; j++) {
                int64_t sumw = letters[i].second + letters[j].second;
                G = gcd64(G, sumw);
            }
        }
    }

    // Factor G into primes by trial division
    vector<pair<int64_t,int>> fac;
    int64_t tmp = G;
    for(int64_t p = 2; p*p <= tmp; p++) {
        if(tmp % p == 0) {
            int cnt = 0;
            while(tmp % p == 0) {
                tmp /= p;
                cnt++;
            }
            fac.emplace_back(p, cnt);
        }
    }
    if(tmp > 1) {
        fac.emplace_back(tmp, 1);
    }

    // Generate all divisors from prime factors
    vector<int64_t> divisors = {1};
    for(auto &pr : fac) {
        int64_t p = pr.first;
        int c = pr.second;
        int sz = (int)divisors.size();
        // For each existing divisor, multiply by p^1, p^2, ... p^c
        for(int i = 0; i < sz; i++) {
            int64_t v = divisors[i];
            for(int e = 1; e <= c; e++) {
                v *= p;
                divisors.push_back(v);
            }
        }
    }
    sort(divisors.begin(), divisors.end());

    // Output the sorted list
    cout << divisors << '\n';
}

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

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

4. Python Solution with Detailed Comments  

```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] = ∑10^(position).  
- Any mapped number N = ∑ mask[c]*digit[c].  
- Swapping two letters x,y changes N by (digit[x]−digit[y])*(mask[x]+mask[y]).  
- Since digit[x]−digit[y] can be ±1, G divides all (mask[x]+mask[y]).  
- If only one letter, G = mask.  
- Compute G = gcd of all mask[x]+mask[y]; factor G and list its divisors in ascending order.