Cancel fractions by nn

for(;[g,h]=[a,b]=readline().split('/');print(b>g?a/g+'/'+b/g:a/g))for(;h;)h=g%(g=h)

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

download

return to the top page