diff --git a/config/scripts/lestrte b/config/scripts/lestrte index f20360d..dfea20e 100755 --- a/config/scripts/lestrte +++ b/config/scripts/lestrte @@ -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="") diff --git a/config/scripts/letrtes b/config/scripts/letrtes new file mode 100755 index 0000000..d6cfa0e --- /dev/null +++ b/config/scripts/letrtes @@ -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="")