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
Saimadhav Heblikar: 2013-11-30 07:45:37

AC in first attempt :)

Aswin Murugesh: 2013-10-20 07:29:41

Easy one in Python :)

sharad gupta: 2013-09-13 18:45:22

can anyone some test cases

BLANKRK: 2013-07-16 11:20:45

wow!!! got AC in fst attmpt... :P

Prikshit Kumar: 2013-06-17 04:00:33

How come the answer for 2nd test case is 17? I am able to get only 6(2 bcoz of dual and 4 bcoz of would ).

Monkey D. Luffy : 2013-04-03 13:12:11

time limit not strict

Just Trying: 2012-12-30 16:07:01

@Divanshu I m also using getchar() my solution is give correct on my machine but giving wrong ans here..

Last edit: 2012-12-30 16:07:30
!(loGic): 2012-12-28 12:17:38

@Ben Dilts: Can u pls tell..for which case my code fails...ID :8364243
Continsly geting WA...:|

Divanshu: 2012-12-23 16:43:00

What is the constraint for words/player ?
And, bad input formatting. Take care using 'getchar()' in C/C++.

EDIT: Problem statement modified.

Last edit: 2012-12-23 16:41:53
(Tjandra Satria Gunawan)(曾毅昆): 2012-12-23 16:43:00

suddenly I know how to solve this problem efficiently ;-)


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