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
dwij28: 2016-04-18 19:27:04

Can someone please explain to me why this problem has a time limit of 9.479 seconds ? My pure brute force python solution runs in 0.02 seconds and it is very easy to reach 0.00 seconds.

Baojun Wang: 2015-08-13 09:05:13

small input data.

ashish kumar: 2015-02-21 18:02:21

AC in one go

Archit Jain: 2014-09-30 14:19:54

easy one

salman: 2014-06-10 19:39:14

some testcases plz ...

monera: 2014-05-22 15:07:54

at last done .. learnt something new :D

Kaushik: 2014-04-30 19:43:56

STL rocks ;)

NISHANT RAJ: 2014-03-16 22:03:45

AC in first attempt using c++ inbuilt function..

kelaseek: 2014-03-16 04:06:40

dude. why nzec error?pls pls check;id:11255518
ac with array size 100 . it's greater than 50

Last edit: 2014-03-16 04:20:23
jobanpreet singh: 2014-02-26 21:12:19

please provide some test cases.
I have tried many on ideone and i get correct answer for each case.
But getting WA here.


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