s="" while 1:a=raw_input(s).strip('" ');b=s[:s.find(" ",5)+1]*(a>"Z")+a;s=b+s[len(b):-(b[-1]>".")]+"\n"