/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author cteam041
*/
import java.util.Scanner;
import java.util.HashMap;
public class Fs {
/**
* @param args the command line arguments
*/
int counter=0;
int[] chars=new int[cipher.length()];
for(int i=0;i<cipher.length();i++) {
s+=cipher.charAt(i);
morse+=table.get(s);
chars[i]=table.get(s).length();
}
for(int i=chars.length-1;i>=0;i--) {
decoded+=table2.get(morse.substring(counter, counter+chars[i]));
counter+=chars[i];
}
return decoded;
}
public static void main
(String[] args
) { HashMap
<String,String
> charToCode
=new HashMap
<String,String
>(); charToCode.put("A", ".-");
charToCode.put("B", "-...");
charToCode.put("C", "-.-.");
charToCode.put("D", "-..");
charToCode.put("E", ".");
charToCode.put("F", "..-.");
charToCode.put("G", "--.");
charToCode.put("H", "....");
charToCode.put("I", "..");
charToCode.put("J", ".---");
charToCode.put("K", "-.-");
charToCode.put("L", ".-..");
charToCode.put("M", "--");
charToCode.put("N", "-.");
charToCode.put("O", "---");
charToCode.put("P", ".--.");
charToCode.put("Q", "--.-");
charToCode.put("R", ".-.");
charToCode.put("S", "...");
charToCode.put("T", "-");
charToCode.put("U", "..-");
charToCode.put("V", "...-");
charToCode.put("W", ".--");
charToCode.put("X", "-..-");
charToCode.put("Y", "-.--");
charToCode.put("Z", "--..");
charToCode.put("_", "..--");
charToCode.put(",", ".-.-");
charToCode.put(".", "---.");
charToCode.put("?", "----");
HashMap
<String,String
> charToCode2
=new HashMap
<String,String
>(); charToCode2.put(".-","A");
charToCode2.put("-...","B");
charToCode2.put("-.-.","C");
charToCode2.put("-..","D");
charToCode2.put(".","E");
charToCode2.put("..-.","F");
charToCode2.put("--.","G");
charToCode2.put("....","H");
charToCode2.put("..","I");
charToCode2.put(".---","J");
charToCode2.put("-.-","K");
charToCode2.put(".-..","L");
charToCode2.put("--","M");
charToCode2.put("-.","N");
charToCode2.put("---","O");
charToCode2.put(".--.","P");
charToCode2.put("--.-","Q");
charToCode2.put(".-.","R");
charToCode2.put("...","S");
charToCode2.put("-","T");
charToCode2.put("..-","U");
charToCode2.put("...-","V");
charToCode2.put(".--","W");
charToCode2.put("-..-","X");
charToCode2.put("-.--","Y");
charToCode2.put("--..","Z");
charToCode2.put("..--","_");
charToCode2.put(".-.-",",");
charToCode2.put("---.",".");
charToCode2.put("----","?");
Scanner sc
=new Scanner
(System.
in); while(true) {
try{
System.
out.
println(decode
(cipher,charToCode,charToCode2
)); break;
}
}
// TODO code application logic here
}
}