while 1: f=raw_input().split().count for x in'm kg s A K mol cd'.split(): \x09n=f(x)+2*f(x+'2') \x09if n:print x+`n`*(n>1), print
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page