BOGGLE - Boggle Scoring

no tags 

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

hide comments
saket diwakar: 2012-12-23 16:43:00

too panic to code it...

Piyush Kumar: 2012-12-23 16:43:00

@ Rodolfo : there don't seem to be test cases where one person finds multiple entries of same word

Rodolfo Riyoei Goya [USJT]: 2012-12-23 16:43:00

@Piyush Kumar
Tks for your comment. I tested again and I agree.

Last edit: 2012-11-19 00:57:45
Sharavana guru: 2012-12-23 16:43:00

words contain only 'a' to 'z' ???

EDIT: Problem statement modified.

Last edit: 2012-12-23 16:42:07
Ranker: 2012-12-23 16:43:00

int in C++/C is sufficient....

Andres R. Arrieche S. [UCLA-ve]: 2012-12-23 16:43:00

Constraints please

EDIT: Problem statement modified.

Last edit: 2012-12-23 16:42:33
Pranay: 2012-12-23 16:43:00

limits please ..


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