import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; /** * Solution to Morse Redux. * * @author vanb */ public class morse_vanb { /** The Input. */ private static Scanner sc; /** The Output. */ private static PrintStream ps; /** The Morse Code Patterns. We only need 26, so this is more than enough. */ private char patterns[][] = { ".".toCharArray(), "_".toCharArray(), "..".toCharArray(), "._".toCharArray(), "_.".toCharArray(), "__".toCharArray(), "...".toCharArray(), ".._".toCharArray(), "._.".toCharArray(), ".__".toCharArray(), "_..".toCharArray(), "_._".toCharArray(), "__.".toCharArray(), "___".toCharArray(), "....".toCharArray(), "..._".toCharArray(), ".._.".toCharArray(), "..__".toCharArray(), "._..".toCharArray(), "._._".toCharArray(), ".__.".toCharArray(), ".___".toCharArray(), "_...".toCharArray(), "_.._".toCharArray(), "_._.".toCharArray(), "_.__".toCharArray(), "__..".toCharArray(), "__._".toCharArray(), "___.".toCharArray(), "____".toCharArray(), ".....".toCharArray(), "...._".toCharArray(), "..._.".toCharArray(), "...__".toCharArray(), ".._..".toCharArray(), ".._._".toCharArray(), "..__.".toCharArray(), "..___".toCharArray(), "._...".toCharArray(), "._.._".toCharArray(), "._._.".toCharArray(), "._.__".toCharArray(), ".__..".toCharArray(), ".__._".toCharArray(), ".___.".toCharArray(), ".____".toCharArray(), "_....".toCharArray(), "_..._".toCharArray(), "_.._.".toCharArray(), "_..__".toCharArray(), "_._..".toCharArray(), "_._._".toCharArray(), "_.__.".toCharArray(), "_.___".toCharArray(), "__...".toCharArray(), "__.._".toCharArray(), "__._.".toCharArray(), "__.__".toCharArray(), "___..".toCharArray(), "___._".toCharArray(), "____.".toCharArray(), "_____".toCharArray() }; /** * Do it. */ private void doit() { // Figure out the lengths of each of the patterns. int lengths[] = new int[patterns.length]; for( int i=0; i