while 1: s=raw_input() r=l='' b=f=0 for c in s: if c=='#' and l=='#':f=1 elif not b and not f and l=='#' and c==' ':b=1 elif (b or f) and l=='#' and c==' ':f=0;b=0 if c=='#':r+=c elif b:r+='.' else:r+=c l=c print r