import java.io.BufferedReader;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
/**
*
* @author cteam020
*/
public class Fs {
public static void main
(String[] args
) { Scanner sc
= new Scanner
(System.
in); StringBuilder sb;
HashMap
<String, String
> toMorse
= new HashMap
<String, String
>(); HashMap
<String, String
> fromMorse
= new HashMap
<String, String
>(); int[] morseLength;
toMorse.put("A", ".-");
toMorse.put("B", "-...");
toMorse.put("C", "-.-.");
toMorse.put("D", "-..");
toMorse.put("E", ".");
toMorse.put("F", "..-.");
toMorse.put("G", "--.");
toMorse.put("H", "....");
toMorse.put("I", "..");
toMorse.put("J", ".---");
toMorse.put("K", "-.-");
toMorse.put("L", ".-..");
toMorse.put("M", "--");
toMorse.put("N", "-.");
toMorse.put("O", "---");
toMorse.put("P", ".--.");
toMorse.put("Q", "--.-");
toMorse.put("R", ".-.");
toMorse.put("S", "...");
toMorse.put("T", "-");
toMorse.put("U", "..-");
toMorse.put("V", "...-");
toMorse.put("W", ".--");
toMorse.put("X", "-..-");
toMorse.put("Y", "-.--");
toMorse.put("Z", "--..");
toMorse.put("_", "..--");
toMorse.put(",", ".-.-");
toMorse.put(".", "---.");
toMorse.put("?", "----");
fromMorse.put(".-","A" );
fromMorse.put("-...","B" );
fromMorse.put("-.-.","C" );
fromMorse.put("-..","D" );
fromMorse.put(".","E" );
fromMorse.put("..-.","F" );
fromMorse.put("--.","G" );
fromMorse.put("....","H" );
fromMorse.put("..","I" );
fromMorse.put(".---","J" );
fromMorse.put("-.-","K" );
fromMorse.put(".-..","L" );
fromMorse.put("--","M" );
fromMorse.put("-.","N" );
fromMorse.put("---","O" );
fromMorse.put(".--.","P" );
fromMorse.put("--.-","Q" );
fromMorse.put(".-.", "R");
fromMorse.put("...","S" );
fromMorse.put("-","T" );
fromMorse.put("..-","U");
fromMorse.put("...-", "V");
fromMorse.put(".--","W" );
fromMorse.put("-..-","X" );
fromMorse.put("-.--", "Y");
fromMorse.put("--..", "Z");
fromMorse.put( "..--","_");
fromMorse.put(".-.-", ",");
fromMorse.put("---.","." );
fromMorse.put("----", "?");
while(sc.hasNext()) {
msg = sc.next();
morseLength = new int[msg.length()];
sb = new StringBuilder();
for (int i = 0; i < msg.length(); i++) {
sb.append( s );
morseLength[msg.length()-1-i] = s.length();
}
msg = sb.toString();
int i = 0;
int a = 0;
sb = new StringBuilder();
for (int j = 0; j < morseLength.length; j++) {
int b = morseLength[i++];
String s
= fromMorse.
get(msg.
substring(a, a
+b
));
sb.append(s);
a += b;
}
}
}
}