/*--------------------------------------------------------------*/
/* ACM ICPC 2007-2008                                           */
/* Northeastern European Regional Contest                       */
/* St Petersburg - Barnaul - Tashkent - Batumi, November 28, 200*/
/*--------------------------------------------------------------*/
/* Problem I. I18n                                              */
/*--------------------------------------------------------------*/
/* Solution                                                     */
/*                                                              */
/* Author                Michael Dvorkin                        */
/*--------------------------------------------------------------*/
 
import java.io.*;
import java.util.*;

public class i18n_md implements Runnable {

	private Scanner in;
	private PrintWriter out;

	public void run() {
		try {
			solve();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
	
	HashMap<String, String> hm = new HashMap<String, String>();
	
	private String process(String s) {
		s = s.toLowerCase();
		if (s.length() < 3 || !Character.isDigit(s.charAt(1))) {
			String t = s.charAt(0) + "" + (s.length() - 2) + "" + s.charAt(s.length() - 1);
			if (hm.containsKey(t)) {
				String ss = hm.get(t);
				if (!s.equals(ss)) {
					hm.put(t, t);
				}
			} else {
				hm.put(t, s);
			}
			return s;
		}
		if (hm.containsKey(s))
			return hm.get(s);
		return s;
	}
	
	private String proc(String s) {
		String w = process(s);
		boolean f = Character.isUpperCase(s.charAt(0));
		boolean l = Character.isUpperCase(s.charAt(s.length() - 1));
		if (l)
			return w.toUpperCase();
		if (f)
			w = Character.toUpperCase(w.charAt(0)) + w.substring(1);
		return w;
	}

	private void solve() throws IOException {
		in = new Scanner(new FileReader("i18n.in"));
		out = new PrintWriter("i18n.out");
		while (in.hasNextLine()) {
			String s = in.nextLine();
			int x = 0;
			while (x < s.length()) {
				while (x < s.length() && !isLetter(s.charAt(x))) {
					out.print(s.charAt(x));
					x++;
				}
				if (x == s.length())
					break;
				String w = "";
				while (x < s.length() && isLetter(s.charAt(x))) {
					w += s.charAt(x);
					x++;
				}
				out.print(proc(w));
			}
			out.println();
		}
		in.close();
		out.close();
	}
	
	private boolean isLetter(char c) {
		return Character.isLetter(c) || Character.isDigit(c);
	}


	public static void main(String[] args) {
		new Thread(new i18n_md()).start();
	}

}
