1175: Word Chain
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:12
Solved:4
Description
不允许普通用户打印题目,请教师登录后使用。如有疑问请联系管理员!
Input
The first line of input is a single integer n (n ≤ 20) representing the number of words. The following n lines each contain a single word. The last line of input is a single character representing the starting letter of the "chain". You can assume that a "chain" starting with this letter definitely exists.
Output
Only output the length of the longest "chain" starting with this letter.
Sample Input Copy
5
at
touch
cheat
choose
tact
a
Sample Output Copy
23
HINT
The answer of sample case is "atoucheatactactouchoose"