dotfiles/config/scripts/lestrte

22 lines
435 B
Python
Executable file

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