Poamcfnrree irvmmpneotes to ltrsete and adedd letetrs
This commit is contained in:
parent
97b6cec7d1
commit
fd4722f989
|
@ -3,26 +3,19 @@
|
|||
import sys
|
||||
import random
|
||||
|
||||
# maj = True
|
||||
|
||||
for line in sys.stdin:
|
||||
nl = ""
|
||||
word = ""
|
||||
grace = True
|
||||
for c in line:
|
||||
if c.isalpha():
|
||||
if grace:
|
||||
nl += word
|
||||
nl += c
|
||||
word = ""
|
||||
grace = False
|
||||
else:
|
||||
word += c
|
||||
else:
|
||||
wrd = list(word)
|
||||
if len(word) > 2:
|
||||
wrd = list(word)[1:]
|
||||
random.shuffle(wrd)
|
||||
nl += "".join(wrd)
|
||||
nl += c
|
||||
nl += word[0] + "".join(wrd)
|
||||
else:
|
||||
nl += word
|
||||
word = ""
|
||||
grace = True
|
||||
nl += c
|
||||
print(nl, end="")
|
||||
|
|
21
config/scripts/letrtes
Executable file
21
config/scripts/letrtes
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import random
|
||||
|
||||
for line in sys.stdin:
|
||||
nl = ""
|
||||
word = ""
|
||||
for c in line:
|
||||
if c.isalpha():
|
||||
word += c
|
||||
else:
|
||||
if len(word) > 3:
|
||||
wrd = list(word)[1:-1]
|
||||
random.shuffle(wrd)
|
||||
nl += word[0] + "".join(wrd) + word[-1]
|
||||
else:
|
||||
nl += word
|
||||
word = ""
|
||||
nl += c
|
||||
print(nl, end="")
|
Loading…
Reference in a new issue