Code Submission Evaluation System Login

CSES - HIIT Open 2016

HIIT Open 2016

Contest start:2016-05-28 11:00:00
Contest end:2016-05-28 16:00:00

Task list | Submit code | Submissions | Messages | Scoreboard | Statistics


History
2016-05-28 11:31:19
Task:HIIT remains
Sender:Ace of Spades
Submission time:2016-05-28 11:31:19
Status:READY
Result:ACCEPTED

Show test data

Code

def Ts(S):
	L = [1,0,0,0,0]	
	for i in S:
		if i == "H":
			L[1] += L[0]
		elif i == "I":
			L[3] += L[2]
			L[2] += L[1]
		elif i == "T":
			L[4] += L[3]
	return L[4]

def main():
	t = int(raw_input())
	res = []
	for i in range(t):
		res.append(str( Ts(raw_input()) ))
	print "\n".join(res)
	
	
main()