Codeforces Round 327 (Div. 1)
E
Birthday
Codeforces
3200
原题
← D→
翻译中…

Today is birthday of a Little Dasha — she is now 8 years old! On this occasion, each of her $*n*$ friends and relatives gave her a ribbon with a greeting written on it, and, as it turned out, all the greetings are different. Dasha gathered all the ribbons and decided to throw away some of them in order to make the remaining set stylish. The birthday girl considers a set of ribbons stylish if no greeting written on some ribbon is a substring of another greeting written on some other ribbon. Let us recall that the substring of the string $*s*$ is a continuous segment of $*s*$.

翻译中…

Help Dasha to keep as many ribbons as possible, so that she could brag about them to all of her friends. Dasha cannot rotate or flip ribbons, that is, each greeting can be read in a single way given in the input.

翻译中…

Input

翻译中…

The first line of the input contains integer $*n*$ ($1 ≤ *n* ≤ 750$) — the number of Dasha's relatives and friends.

翻译中…

Each of the next $*n*$ lines contains exactly one greeting. Each greeting consists of characters 'a' and 'b' only.

翻译中…

The total length of all greetings won't exceed $10 000 000$ characters.

翻译中…

Output

翻译中…

In the first line print the maximum size of the stylish set. In the second line print the numbers of ribbons involved in it, assuming that they are numbered from $1$ to $*n*$ in the order they appear in the input. If there are several stylish sets of the maximum size, print any of them.

翻译中…

Note

翻译中…

In the sample, the answer that keeps ribbons 3 and 4 is also considered correct.

翻译中…

样例

Input #1
5
abab
aba
aabab
ababb
bab
Output #1
2
2 5
InputCopy OutputCopy
题目信息
题号
590E
时间限制
3 s
内存限制
512 MB
标签
图匹配
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。