PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from random import sample
def typoglycemia(ws):
for w in ws.split():
if len(w) <= 3 or all(x==w[1]
for x in w[2:-1]):
print(w,end=' ')
continue
w2 = w
while w[0] + w[1:-1] + w[-1] == w2:
w = w[0] + ''.join(sample(w[1:-1],len(w[1:-1]))) + w[-1]
print(w,end=' ')
#typoglycemia(input())
txt = "This is a very long text to test the code and it does not makes sence so today is a day weird and this is a weird text that you cannot understand and so nothing metters"
typoglycemia(txt)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run