import java.util.Scanner;
/**
*
* @author cteam049
*/
public class Main {
enum Morse {
A(".-"),
B("-..."),
C("-.-."),
D("-.."),
E("."),
F("..-."),
G("--."),
H("...."),
I(".."),
J(".---"),
K("-.-"),
L(".-.."),
M("--"),
N("-."),
O("---"),
P(".--."),
Q("--.-"),
R(".-."),
S("..."),
T("-"),
U("..-"),
V("...-"),
X("-..-"),
W(".--"),
Y("-.--"),
Z("--.."),
u("..--"),
c(".-.-"),
p("---."),
q("----");
int length;
this.sym = sym;
this.length = sym.length();
}
return sym;
}
public int getLength() {
return length;
}
public static Morse getValue
(String sym
) { if (".-".equals(sym)) {
return A;
} else if ("-...".equals(sym)) {
return B;
} else if ("-.-.".equals(sym)) {
return C;
} else if ("-..".equals(sym)) {
return D;
} else if (".".equals(sym)) {
return E;
} else if ("..-.".equals(sym)) {
return F;
} else if ("--.".equals(sym)) {
return G;
} else if ("....".equals(sym)) {
return H;
} else if ("..".equals(sym)) {
return I;
} else if (".---".equals(sym)) {
return J;
} else if ("-.-".equals(sym)) {
return K;
} else if (".-..".equals(sym)) {
return L;
} else if ("--".equals(sym)) {
return M;
} else if ("-.".equals(sym)) {
return N;
} else if ("---".equals(sym)) {
return O;
} else if (".--.".equals(sym)) {
return P;
} else if ("--.-".equals(sym)) {
return Q;
} else if (".-.".equals(sym)) {
return R;
} else if ("...".equals(sym)) {
return S;
} else if ("-".equals(sym)) {
return T;
} else if ("..-".equals(sym)) {
return U;
} else if ("...-".equals(sym)) {
return V;
} else if ("-..-".equals(sym)) {
return X;
} else if (".--".equals(sym)) {
return W;
} else if ("-.--".equals(sym)) {
return Y;
} else if ("--..".equals(sym)) {
return Z;
} else if ("..--".equals(sym)) {
return u;
} else if (".-.-".equals(sym)) {
return c;
} else if ("---.".equals(sym)) {
return p;
} else if ("----".equals(sym)) {
return q;
}
}
}
String newLine
= line.
replaceAll("_",
"u") .replaceAll(",", "c")
.replaceAll("\\.", "p")
.replaceAll("\\?", "q");
StringBuilder morseSB = new StringBuilder();
StringBuilder lengthSB = new StringBuilder();
for (int i=0; i<newLine.length() ; i++) {
char ch = newLine.charAt(i);
// System.out.println(String.valueOf(ch) + " " + Morse.valueOf(String.valueOf(ch)).getMorse());
morseSB.
append(Morse.
valueOf(String.
valueOf(ch
)).
getMorse()); lengthSB.
append(Morse.
valueOf(String.
valueOf(ch
)).
getLength()); }
String lengthString
= lengthSB.
reverse().
toString(); String morseString
= morseSB.
toString();
// System.out.println("*********");
// System.out.println(morseString);
// System.out.println(lengthString);
// System.out.println("*********");
int pointer = 0;
morseSB.delete(0, morseSB.capacity());
for (int i=0; i<lengthString.length() ; i++) {
int len
= Integer.
parseInt( String.
valueOf( lengthString.
charAt(i
) ) ); // System.out.println(morseString.substring(pointer, pointer+len));
// System.out.println( Morse.getValue( morseString.substring(pointer, pointer+len) ) );
morseSB.append( Morse.getValue(morseString.substring(pointer, pointer+len)) );
pointer = pointer+len;
}
return morseSB.toString().replaceAll("u", "_")
.replaceAll("c", ",")
.replaceAll("p", "\\.")
.replaceAll("q", "\\?");
}
public static void main
(String[] args
) { Scanner sc
= new Scanner
(System.
in); while (sc.hasNext()) {
line = sc.next();
System.
out.
println(solve
(line
)); }
}
}