Poamcfnrree irvmmpneotes to ltrsete and adedd letetrs

This commit is contained in:
Geoffrey Frogeye 2021-10-17 14:31:09 +02:00
parent 97b6cec7d1
commit fd4722f989
2 changed files with 29 additions and 15 deletions

View File

@ -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
word += c
else:
wrd = list(word)
random.shuffle(wrd)
nl += "".join(wrd)
nl += c
if len(word) > 2:
wrd = list(word)[1:]
random.shuffle(wrd)
nl += word[0] + "".join(wrd)
else:
nl += word
word = ""
grace = True
nl += c
print(nl, end="")

21
config/scripts/letrtes Executable file
View 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="")