The set of sequences of length n ending in HH (and with no earlier HH) and beginning with a T are in bijection with the set of sequences of length n-1 ending in HH (and with no earlier HH) by the bijection
def f(s):
assert(s[0] == 'T')
return s[1:]
whose inverse is def f_inverse(s):
return 'T' + s