#!/usr/bin/env python

# jumbles middle letters of words
# barnett 9/18/03

import string, sys, random

def shuffle(x):
    'random shuffle a list, Fisher-Yates'
    for i in xrange(len(x)-1, 0, -1):
        # pick an element in x[:i+1] with which to exchange x[i]
        j = int(random.random() * (i+1))
        x[i], x[j] = x[j], x[i]

f = sys.stdin
t = f.readlines()
f.close()

for l in t:
    ws = string.split(l)
    wso = []
    for w in ws: # w is a word
        if len(w)>3: # don't bother if 3 or less    
            if string.find(string.lowercase,w[-1]) == -1:
                # last letter is punctuation
                i = -2
            else:
                i = -1
            lw = list(w)
            m = lw[1:i]
            shuffle(m)
            lw[1:i] = m
            wso.append(string.join(lw, ''))
        else:
            wso.append(w)
            
    print string.join(wso)
