IntermediateRating 1300
Word Chain Game
Each word must start with the last letter of the previous word, and no word may be used twice. Print the number (from 1) of the first word that breaks a rule, or OK if all are fine.
Input
n, then n words separated by spaces.
Output
One integer or OK.
Sample 1
Input
4 apple egg goat tiger
Output
OK
Sample 2
Input
3 apple egg apple
Output
3
Output appears here