Cancel fractions by henkma(insp notogawa)

m@main=getLine>>=putStrLn.f.lex>>m
f[(a,s:b)]=a#b:[s:b#a|b#a>"1"]>>=id
a#b=show$div%a$gcd%a%b
(%)=(.read)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page