main=interact$(>>=f).lines f('A':'T':_:x)=g x f(_:x)=f x f _="\n" g(a:b:c:x)|[a,b]/="TA"=a:b:c:g x g _=f""
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page