/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package fo;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
/**
*
* @author cteam017
*/
public class Fs {
public static void main
(String[] args
) { Scanner sc
= new Scanner
(System.
in); ArrayList<Integer> lengths = new ArrayList<Integer>();
while (sc.hasNext()) {
for (int i = 0; i < line.length(); i++) {
String morsedChar
= toMorse
(line.
charAt(i
)); int morsedLen = morsedChar.length();
lengths.add(morsedLen);
morsedText += morsedChar;
// System.out.println(line.charAt(i) + " -> " + morsedChar + " " + morsedLen);
}
lenStrs+=i;
}
// System.out.println("Coded into: "+morsedText + " " + lenStrs);
String res
= decodeMorse
(morsedText, lengths
);
lengths.clear();
}
}
static String decodeMorse
(String in, ArrayList
<Integer
> lengths
) { // System.out.println("\n\n\n\nDECODE MORSE: "+in);
int pos = 0;
for (int i = 0; i < lengths.size(); i++) {
// System.out.println("new char, its len=" + lengths.get(i));
for (int k = 0; k < lengths.get(i); k++) {
// System.out.println(" NewChar += " + in.charAt(pos) + " pos="+pos);
newChar += in.charAt(pos++);
}
// System.out.println(" char completed: "+newChar);
res+=fromMorse(newChar);
// System.out.println("-- res so far: "+res);
}
return res;
}
static char fromMorse
(String in
) { if (in.equals(".-")) {
return 'A';
}
if (in.equals("-...")) {
return 'B';
}
if (in.equals("-.-.")) {
return 'C';
}
if (in.equals("-..")) {
return 'D';
}
if (in.equals(".")) {
return 'E';
}
if (in.equals("..-.")) {
return 'F';
}
if (in.equals("--.")) {
return 'G';
}
if (in.equals("....")) {
return 'H';
}
if (in.equals("..")) {
return 'I';
}
if (in.equals(".---")) {
return 'J';
}
if (in.equals("-.-")) {
return 'K';
}
if (in.equals(".-..")) {
return 'L';
}
if (in.equals("--")) {
return 'M';
}
if (in.equals("-.")) {
return 'N';
}
if (in.equals("---")) {
return 'O';
}
if (in.equals(".--.")) {
return 'P';
}
if (in.equals("--.-")) {
return 'Q';
}
if (in.equals(".-.")) {
return 'R';
}
if (in.equals("...")) {
return 'S';
}
if (in.equals("-")) {
return 'T';
}
if (in.equals("..-")) {
return 'U';
}
if (in.equals("...-")) {
return 'V';
}
if (in.equals(".--")) {
return 'W';
}
if (in.equals("-..-")) {
return 'X';
}
if (in.equals("-.--")) {
return 'Y';
}
if (in.equals("--..")) {
return 'Z';
}
if (in.equals("..--")) {
return '_';
}
if (in.equals(".-.-")) {
return ',';
}
if (in.equals("---.")) {
return '.';
}
if (in.equals("----")) {
return '?';
}
return '*';
}
static String toMorse
(char letter
) { switch (letter) {
case 'A':
return ".-";
case 'B':
return "-...";
case 'C':
return "-.-.";
case 'D':
return "-..";
case 'E':
return ".";
case 'F':
return "..-.";
case 'G':
return "--.";
case 'H':
return "....";
case 'I':
return "..";
case 'J':
return ".---";
case 'K':
return "-.-";
case 'L':
return ".-..";
case 'M':
return "--";
case 'N':
return "-.";
case 'O':
return "---";
case 'P':
return ".--.";
case 'Q':
return "--.-";
case 'R':
return ".-.";
case 'S':
return "...";
case 'T':
return "-";
case 'U':
return "..-";
case 'V':
return "...-";
case 'W':
return ".--";
case 'X':
return "-..-";
case 'Y':
return "-.--";
case 'Z':
return "--..";
case '_':
return "..--";
case ',':
return ".-.-";
case '.':
return "---.";
case '?':
return "----";
}
return "";
}
}