#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include // #include // #include // #include // #include #define int long long #define all(x) begin(x), end(x) using namespace std; // using namespace atcoder; // using mint = modint998244353; // using mint = modint1000000007; using ld = long double; using pii = pair; using vi = vector; using vvi = vector; using vvvi = vector; using vp = vector; using vvp = vector; using vs = vector; using vvc = vector>; void debug(vector a) { for (auto x : a) cout << x << ' '; cout << endl; } void debug(vector> a) { for (auto y : a) debug(y); } template inline bool chmax(T1 &a, T2 b) {return a < b and (a = b, true);} template inline bool chmin(T1 &a, T2 b) {return a > b and (a = b, true);} const int supl = LONG_LONG_MAX - 100; void main_() { int n; cin >> n; map mp; vs ss(n); for (auto& s : ss) cin >> s; for (auto s : ss) mp[s]++; vi anses(n); for (int i = 0 ; i < n ; i++) { for (auto& c : ss[i]) { char origin = c; for (char t = 'a' ; t <= 'z' ; t++) if (t != origin) { c = t; if (mp.count(ss[i])) anses[i] += mp[ss[i]]; } c = origin; } } for (auto ans : anses) cout << ans << endl; } signed main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); main_(); return 0; }