#!/usr/bin/python
# -*- coding: utf-8 -*-
import random

def typoglycemia(str):
    l = []
    for s in str.split():
        if len(s) <= 4:
            l.append(s)
        else:
            sl = list(s[1:len(s) - 1])
            random.shuffle(sl)
            s = s[0] + ''.join(sl) + s[len(s) - 1]
            l.append(s)
    str = ' '.join(l)
    return str

if __name__ == '__main__':
    str = "I couldn't believe that I could actually understand what I was reading : the phenomenal power of the human mind ."
    print typoglycemia(str)
