# No.1994 Confusing Name import numpy as np LEN = 10 N = int(input()) S = [input() for i in range(N)] nn = np.zeros((N), dtype='int32') for k in range(LEN): ti = [(s[:k]+s[k+1:], i) for s,i in zip(S, range(N)) if len(s)>k] ti.sort() t0 = '' ii = [] for t, i in ti: if t == t0: ii.append(i) else: #nn[ii] += len(ii)-1 for j in ii: nn[j] += len(ii)-1 ii = [i] t0 = t #nn[ii] += len(ii)-1 for j in ii: nn[j] += len(ii)-1 for n in nn: print(n)