while 1: t=raw_input().count for s in"m kg s A K mol cd".split(): n=t(s)+t(s+'2')-t(s+'o') if n:print s+1%n*`n`, print