Cancel fractions by hallvabo

while 1:
\x09a,b=n,d=map(int,raw_input().split("/"))
\x09while b:a,b=b,a%b
\x09print`n/a`+('/'+`d/a`)*(d>a)

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

download

return to the top page