fork(1) download
  1. f = lambda s:''.join(c+c.swapcase()*c.isalpha()for c in s)
  2.  
  3. for s in 'bad', 'Nice', 'T e S t', 's E t', '1!1!1st!', 'n00b', '(e.g.)', 'H3l|@!':
  4. print '%-11s%s' % (s,f(s))
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
bad        bBaAdD
Nice       NniIcCeE
T e S t    Tt eE Ss tT
s E t      sS Ee tT
1!1!1st!   1!1!1sStT!
n00b       nN00bB
(e.g.)     (eE.gG.)
H3l|@!     Hh3lL|@!