Public part of my dotfiles.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
448 B

  1. #!/usr/bin/env python3
  2. import sys
  3. import random
  4. for line in sys.stdin:
  5. nl = ""
  6. word = ""
  7. for c in line:
  8. if c.isalpha():
  9. word += c
  10. else:
  11. if len(word) > 3:
  12. wrd = list(word)[1:-1]
  13. random.shuffle(wrd)
  14. nl += word[0] + "".join(wrd) + word[-1]
  15. else:
  16. nl += word
  17. word = ""
  18. nl += c
  19. print(nl, end="")