BOGGLE - 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.

Sample

Input
2
one two three
two three four

Output
1
Input
3
good dual strange stranger would
dual would duality dregs gnaw
dual gnaw draw would student

Output
17
Input
2
grid grades dread bread thread threads
grid grids grade brood broods thread threads

Output
9

Added by:Ben Dilts
Date:2012-10-12
Time limit:9.479s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2012-12-23 16:43:00 saket diwakar
too panic to code it...
2012-12-23 16:43:00 Piyush Kumar
@ Rodolfo : there don't seem to be test cases where one person finds multiple entries of same word
2012-12-23 16:43:00 Rodolfo Riyoei Goya [USJT]
@Piyush Kumar
Tks for your comment. I tested again and I agree.

Last edit: 2012-11-19 00:57:45
2012-12-23 16:43:00 Sharavana guru
words contain only 'a' to 'z' ???

EDIT: Problem statement modified.

Last edit: 2012-12-23 16:42:07
2012-12-23 16:43:00 Ranker
int in C++/C is sufficient....
2012-12-23 16:43:00 Andres R. Arrieche S. [UCLA-ve]
Constraints please

EDIT: Problem statement modified.

Last edit: 2012-12-23 16:42:33
2012-12-23 16:43:00 Pranay
limits please ..
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.