by@henkma
AC
1129ms
main=interact$unlines.scanl1(!).lines a!b|(x,y)<-span(<'J')$zipWith max a b=x++scanr1 max y
T K
T T T T T T T T T T T T T T T T TTTTTTTTTTTTTTTTT