

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
英小文字からなる文字列が 個与えられます。 番目のものを と表します。
二つの文字列 に対し、以下の条件を全て満たす最大の整数 を と表します。
- の長さはいずれも 以上
- 以上 以下の全ての整数 に対し、 の 文字目と の 文字目が等しい
全ての に対し、以下の値を求めてください。
制約
- は整数
- は英小文字からなる長さ 以上の文字列
- の長さの総和は 以下
入力
入力は以下の形式で標準入力から与えられる。
出力
行出力せよ。 行目には、 を出力せよ。
入力例 1Copy
3 abc abb aac
出力例 1Copy
2 2 1
です。
入力例 2Copy
11 abracadabra bracadabra racadabra acadabra cadabra adabra dabra abra bra ra a
出力例 2Copy
4 3 2 1 0 1 0 4 3 2 1
Score : points
Problem Statement
You are given strings consisting of lowercase English letters. Let be the -th of them.
For two strings and , is defined to be the maximum integer that satisfies all of the following conditions:
- The lengths of and are both at least .
- For all integers between and , inclusive, the -th character of and that of are equal.
Find the following value for all :
Constraints
- is an integer.
- is a string of length at least consisting of lowercase English letters .
- The sum of lengths of is at most .
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain .
Sample Input 1Copy
3 abc abb aac
Sample Output 1Copy
2 2 1
, and .
Sample Input 2Copy
11 abracadabra bracadabra racadabra acadabra cadabra adabra dabra abra bra ra a
Sample Output 2Copy
4 3 2 1 0 1 0 4 3 2 1