#!/usr/bin/python3.9 import functools def calc_test(test): return functools.reduce(lambda x,y:x*y, map(lambda x: 1 if x == 'T' else 0, test)) n = int(input()) s = input() testlen = n//10 l = [ s[i:i+testlen] for i in range(0, n, testlen) ] print(functools.reduce(lambda x,y:x+y, map(calc_test, l)))
1 2 3 4 5 6 7 8 9 10 11 12 13 | #!/usr/bin/python3.9 import functools def calc_test(test): return functools.reduce(lambda x,y:x*y, map(lambda x: 1 if x == 'T' else 0, test)) n = int(input()) s = input() testlen = n//10 l = [ s[i:i+testlen] for i in range(0, n, testlen) ] print(functools.reduce(lambda x,y:x+y, map(calc_test, l))) |