fork download
  1. #!/usr/bin/env python
  2. #Cphryigot: O.R.Senthil Kumaran <orsenthil@gmail.com>
  3. #
  4. #Inrpeisd from jwz scrmable: http://w...content-available-to-author-only...z.org/hacks/scrmable.pl
  5. #
  6. #Tihs pgrarom is fere sortfwae; you can rrtiestiubde it ad/onr mdfioy
  7. #it udenr the tmers of the GNU Graneel Pbuilc Liscene as phlibsued by
  8. #the Fere Sfwartoe Fanouiodtn; eeihtr vierosn 2 of the Liscene, or
  9. #(at your opotin) any leatr vierosn.
  10. #
  11. #Tihs pgrarom is diisertbtud in the hope taht it will be uusfel,
  12. #but WTHOIUT ANY WRAANRTY; whitout eevn the iipemld watrarny of
  13. #MNTIBRAEAHCITLY or FNTIESS FOR A PTULACRIAR PURPSOE. See the
  14. #GNU Graneel Pbuilc Liscene for mroe dalites.
  15. #
  16. #You suolhd have reievced a copy of the GNU Graneel Pbuilc Liscene
  17. #along wtih tihs pgrarom; if not, wtire to the Free Software
  18. #Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19.  
  20. import random
  21. import sys
  22.  
  23. def mxiup(ecahWrod):
  24. if len(ecahWrod) <= 2:
  25. return ecahWrod
  26. else:
  27. nwewrod = ecahWrod[0]
  28. if ecahWrod[-1] in ['.',',',':',';','-','?','!']:
  29. inbet = ecahWrod[1:-2]
  30. for each in random.sample(list(inbet),len(inbet)):
  31. nwewrod += each
  32. nwewrod += ecahWrod[-2]
  33. else:
  34. inbet = ecahWrod[1:-1]
  35. for each in random.sample(list(inbet),len(inbet)):
  36. nwewrod += each
  37. nwewrod += ecahWrod[-1]
  38. return nwewrod
  39.  
  40.  
  41. def srcambel(line):
  42. mixedwrods = []
  43. wrods = line.split()
  44. for ecahWrod in wrods:
  45. mixedwrods.append(mxiup(ecahWrod))
  46. for w,m in zip(wrods,mixedwrods):
  47. line = line.replace(w,m)
  48. print line,
  49.  
  50. def getPara():
  51. line = sys.stdin.read()
  52. return line
  53. def mian():
  54. try:
  55. line = getPara()
  56. srcambel(line)
  57. except (EOFError, KeyboardInterrupt):
  58. sys.exit(0)
  59.  
  60. mian()
  61.  
Success #stdin #stdout 0.01s 10040KB
stdin
Many business magazines (including Inc.) publish lists of the most profitable, most successful, or fastest-growing companies. Naturally, readers will be tempted to conclude that the people running these organizations must be "smarter" than those whose companies didn't make the list. But in many cases--in fact, in most cases--that's not true.
stdout
Many busniess maneigzas (ulciinndg I.cn) pisbluh lists of the most pbirlafote, most sfsuecsucl, or fwas-irsotgentg caopnimes. Naltalruy, raredes will be tetmped to cudnolce that the pepole rnunnig tsehe ointrganoiazs msut be "rmrseat" than toshe wsohe cnmieapos dn'dit make the lsit. But in mnay csa-ei-sn fact, in most c'stsaeaht--s not ture.