def dna_to_rna(dna):
'''(str) -> str
Replace every T with a U
>>>dna_to_rna('GTACTT')
GUACUU
>>>dna_to_rna('GGGGTTTTTCCCCTTTTTATCTGT')
'GGGGUUUUUCCCCUUUUUAUCUGU'
>>>dna_to_rna('TTTTTTTT')
UUUUUUUU
>>>dna_to_rna('TTAA')
UUAA
'''
i = 0
accum_s = ' '
last_t_index = 0
while i < len(dna):
if dna[i] == 'T':
accum_s = accum_s + dna[last_t_index: i] + 'U'
last_t_index = i +1
i = i + 1
if last_t_index != len(dna):
accum_s = accum_s + dna[last_t_index:len(dna)]
print accum_s