for w in split(r"[^\w\d*'~\n]+",sub(' ','~',x))[:-1]:l=len(sub("[*'~\n]",'',w));q='*'in w;d+='. '[w[0]>'}':]*(w[0]in'~\n')+chr(64+l+m)[q:];m=(2-l%2)*10*q
print d+'.'
# HELLO.
f('Neurotic Frogs *O*ught To Rel*a*x In *M*ud Baths!')
# HINT.
f('Business standards all*o*w only *adult* amphibians.')
f('*I*, happily, *th*anks 2 u *e*ditin*g* specific wor*ding*--clarifying a *bit*--betterment :D!')
# MY NAME IS INIGO MONTOYA. YOU KILLED MY FATHER. PREPARE TO DIE.
f('''Perpendicular l*ou*nging calms. *A* frog, a m*u*d cap... bliss! Wallowing g*e*n*e*rates happiness. Amphibian sp*a* isn't expensive--seventy d*o*llars--cheap! That'*s* not *a* large e*x*pens*e* from an*y* discerning fr*o*g's money, unlik*e* Super 8.
Ever*y*one--frogs, toad*s*, newts, *a*nd salamanders! G*e*t a wonderful shiat*s*u, or recei*v*e an other kind. Masseus*es* are her*e* today! Invite a fianc*e*e, supervisor, roommate, niece: *all* welcomed!
Y*o*u simply ne*v*er believed these p*o*ssibilitie*s*; they're (I *swear*) absolute truth! Th*e* Montgomery A*m*phibian Salon! Come luxuriate today!''')