Problem ID: 11492

Though this is not specified in the problem statement, the number of languages in the judge's input is greater than 2,000 but less than 5,000.

Also, note that if a sequence of words is represented as pairs of languages then the last language in one pair should be the same as the first one in the next pair. So for example, like this: “amigo red date” (Portuguese/Spanish, Spanish/English, English/French). In other words, two consecutive languages separated by commas (not forward slashes) must be the same.