#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; cin >> N; vector S(N); rep(i,N) cin >> S[i]; auto T = S; sort(T.begin(), T.end()); rep(i,N) { int ans = 0; rep(j,int(S[i].size())) { for(char c = 'a'; c <= 'z'; c++) { if(S[i][j] != c) { swap(S[i][j], c); ans += binary_search(T.begin(), T.end(), S[i]); swap(S[i][j], c); } } } cout << ans << "\n"; } }