[Python-Dev] Fsrit Propttoye: SCLABMRE

Frnak "Sealmbcrd Eggs" Lomax lomax at pumpichank.com
Wed Sep 17 09:18:26 EDT 2003


I hvae jsut fhiseind rniedag a Shdlaost atrlcie from Mnoday, Sbepemetr
15th, aobut an ingtriniug sdtuy from Cgbdirmae Uinevtrsiy, dciinesrbg
how wodrs with thier itienrors selmrbacd can siltl be rdbaleae.
Bcaeuse of the tioeznme that I lvie in, an initettrment dfceet in my
clbae medom, and the lneiignrg atfer-ecfefts of my lsat "mohsroum
salad exntarvzagaa", I am aaylws two days bhneid on the Web.

So suentnd was I at the icoinatpimls of this study, taht I
cunlqtneesoy decedid to doetve my etrnie lfie and gtelray aeamssd
fnrtoue on cunitodcng ftrhuer rasreech and dnpeeelmvot into tihs
lifnsaevig tghlocnoey.  As a cross-eeyd dxsiyelc, I konw that teshe
cilmas of svotailan are niehetr hlroyepbe nor bmobaistc
over-daaomtiazitrn.

Pnseetred hree for your rveiew, aaovpprl and disiscsuon, is our
poyptotre sytsem, caelld SLABCRME for SeCren Rslmnebeig Aacrihc
Mnoaaluptiin of BetaoLd Ecuitolon.  I have scnie bugen a meosdt
sutartp based in Aceicdnt Maarnlyd, and we will soon be reeianlsg an
Olutook puglin, anolg with a sftorwae devmoeelpnt kit, and oethr
digintoasc tloos.  Smoe of our tlgeocnhoy wlil nallaruty be open
sruoce, but I do ietnnd and ecpext to frutehr etnxed my hoougmuns
wtaleh by sinlelg sftorawe lcseiens and srhink wrapped ratiel pocrudt.
Psaele cactnot us for more iomrfaiontn.

I'm aslo in enpommelyt duicnssioss wtih the Tmboit; I ecepxt that he
can bosot the pmecarrofne of our pooyptrte's itmpeanetolmin
salreolefvd, at wcihh piont we will be pthincig emdbeded ssmeyts to
the mfntacuuearrs of ruoters, eiltncreoc trprwyeiets, psnreoal dtaiigl
astsntsais, eorctinlec cepmutor coltlerond tersotas, maet prbeos, RFC
1149 digtail cemara pheons, and nxet gniaoetern wopehoe csionuhs.

hinpog-to-be-deotersyd-by-moroscift-ly y'rs,
-fnark

-------------- next part --------------
#! /usr/bin/env python
# Author: Frank "Topsy Turvy" Lomax <lomax at pumpichank.com>

"""Slmbcrae the letrtes in a word.

Tihs was seen on Soalhsdt, so it msut be ture:

Ardcnoicg to resraceh at Cgmdrabie Uesnirtivy, it dsoen't matter in what odrer
the lettres in a wrod are, the olny iotrmpant tnhig is taht the fsrit and lsat
lteter be at the rhigt pcale.

The rest can be a toatl mess and you can sltil raed it wuhoitt peolbrm.  This
is bseacue we do not raed eervy ltteer by it self but the wrod as a wohle.
Cireheo.
"""

import re
import sys
from random import shuffle

EMPTYSTRING = ''


def scrambleword(word):
    if len(word) <= 2:
        return word
    middle = list(word[1:-1])
    shuffle(middle)
    return word[0] + EMPTYSTRING.join(middle) + word[-1]


def main():
    text = sys.stdin.read()
    words = re.split(r'(\W+)', text)
    while words:
        sys.stdout.write(scrambleword(words.pop(0)))
        if words:
            sys.stdout.write(words.pop(0))


if __name__ == '__main__':
    main()


More information about the Python-Dev mailing list