Poamcfnrree irvmmpneotes to ltrsete and adedd letetrs
This commit is contained in:
parent
97b6cec7d1
commit
fd4722f989
|
@ -3,26 +3,19 @@
|
||||||
import sys
|
import sys
|
||||||
import random
|
import random
|
||||||
|
|
||||||
# maj = True
|
|
||||||
|
|
||||||
for line in sys.stdin:
|
for line in sys.stdin:
|
||||||
nl = ""
|
nl = ""
|
||||||
word = ""
|
word = ""
|
||||||
grace = True
|
|
||||||
for c in line:
|
for c in line:
|
||||||
if c.isalpha():
|
if c.isalpha():
|
||||||
if grace:
|
word += c
|
||||||
nl += word
|
|
||||||
nl += c
|
|
||||||
word = ""
|
|
||||||
grace = False
|
|
||||||
else:
|
|
||||||
word += c
|
|
||||||
else:
|
else:
|
||||||
wrd = list(word)
|
if len(word) > 2:
|
||||||
random.shuffle(wrd)
|
wrd = list(word)[1:]
|
||||||
nl += "".join(wrd)
|
random.shuffle(wrd)
|
||||||
nl += c
|
nl += word[0] + "".join(wrd)
|
||||||
|
else:
|
||||||
|
nl += word
|
||||||
word = ""
|
word = ""
|
||||||
grace = True
|
nl += c
|
||||||
print(nl, end="")
|
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