Question code: TYPING
My code:
s=set()
l=["d","f"]
r=["j","k"]
for i in range (int(input())):
a=[]
for j in range (int(input())):
str1=input()
t=0
li=list(str1)
b=len(str1)
if str1 not in s:
s.add(str1)
for x in range(0,b-1):
if (li[x] in l and li[x+1] in l) or (li[x] in r and li[x+1] in r):
t=t+1
ans =(b+t)*0.2 #this is actually (b-t)*0.2 +t*0.4
a.append(ans)
else:
for x in range(0,b-1):
if (li[x] in l and li[x+1] in l) or (li[x] in r and li[x+1] in r):
t=t+1
ans =(b+t)*0.1
a.append(ans)
fans=sum(a)*10
print (int(fans))