Go to diff to previous submission
import java.util.HashMap; import java.util.Scanner; public class main { charToDots.put("A",".-"); charToDots.put("B", "-..."); charToDots.put("C","-.-."); charToDots.put("D", "-.."); charToDots.put("E","."); charToDots.put("F", "..-."); charToDots.put("G","--."); charToDots.put("H", "...."); charToDots.put("I",".."); charToDots.put("J", ".---"); charToDots.put("K","-.-"); charToDots.put("L", ".-.."); charToDots.put("M","--"); charToDots.put("N", "-."); charToDots.put("O","---"); charToDots.put("P", ".--."); charToDots.put("Q","--.-"); charToDots.put("R", ".-."); charToDots.put("S","..."); charToDots.put("T", "-"); charToDots.put("U","..-"); charToDots.put("V", "...-"); charToDots.put("W",".--"); charToDots.put("X", "-..-"); charToDots.put("Y","-.--"); charToDots.put("Z", "--.."); charToDots.put("_", "..--"); charToDots.put(",",".-.-"); charToDots.put(".", "---."); charToDots.put("?","----"); dotsToChar.put(".-","A"); dotsToChar.put("-...","B"); dotsToChar.put("-.-.","C"); dotsToChar.put("-..","D"); dotsToChar.put(".","E"); dotsToChar.put("..-.","F"); dotsToChar.put("--.","G"); dotsToChar.put("....","H"); dotsToChar.put("..","I"); dotsToChar.put(".---","J"); dotsToChar.put("-.-","K"); dotsToChar.put( ".-..","L"); dotsToChar.put("--","M"); dotsToChar.put( "-.","N"); dotsToChar.put("---","O"); dotsToChar.put( ".--.","P"); dotsToChar.put("--.-","Q"); dotsToChar.put( ".-.","R"); dotsToChar.put("...","S"); dotsToChar.put( "-","T"); dotsToChar.put("..-","U"); dotsToChar.put( "...-","V"); dotsToChar.put(".--","W"); dotsToChar.put( "-..-","X"); dotsToChar.put("-.--","Y"); dotsToChar.put("--..","Z"); dotsToChar.put( "..--","_"); dotsToChar.put(".-.-",","); dotsToChar.put( "---.","."); dotsToChar.put("----","?"); String line; while((line = sc.nextLine())!=null){ for(int i = 0; i < line.length(); i++){ codedLine += tmp; numLine += ""+tmp.length(); } //System.out.println(codedLine + " " +numLine); int index = 0; for(int i = numLine.length() - 1; i >= 0; i--){ int result = index + number; index = result; } } } }
--- c5.s580.cteam059.fs.java.0.Main.java +++ c5.s586.cteam059.fs.java.0.main.java @@ -4,9 +4,7 @@ -public class Main { +public class main { - public static void main(String args[]){ - String input = "AKADTOF_IBOETATUK_IJN"; - + public static void main(String args[]){ HashMap<String, String> charToDots = new HashMap<String, String>();