spoj#BOGGLE. Boggle Scoring

Boggle Scoring

In Boggle, you win points for words you find on the board which no other player finds. If another player finds the same word as you, neither player gets points for that word.

For words of 4 or fewer letters, 1 point is awarded. 5-letter words are worth 2 points, 6-letter words are worth 3 points, 7-letter words are worth 5 points, and words longer than 7 letters are worth 11 points.

Given the set of words that some boggle players found, determine the score of the winner.

Input:
The first line is the number of players (at most 100).
Each subsequent line is the space-separated list of no more than than 50 words each no more than 50 characters (ASCII 33-126) that player found

Output:
The score of the winning player

Input Output
2
one two three
two three four
1
3
good dual strange stranger would
dual would duality dregs gnaw
dual gnaw draw would student
17
2
grid grades dread bread thread threads
grid grids grade brood broods thread threads
9