fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner in = new Scanner(System.in);
  13. String User=in.nextLine();
  14. Map<Character, String> hm = new HashMap<>();
  15. hm.put('a', ".-");
  16. hm.put('b', "-...");
  17. hm.put('c', "-.-.");
  18. hm.put('d', "-..");
  19. hm.put('e',".");
  20. hm.put('f',"..-.");
  21. hm.put('g',"--.");
  22. hm.put('h',"....");
  23. hm.put('i',"..");
  24. hm.put('j',".---");
  25. hm.put('k',"-.-");
  26. hm.put('l',".-..");
  27. hm.put('m',"--");
  28. hm.put('n',"-.");
  29. hm.put('o',"---");
  30. hm.put('p',".--.");
  31. hm.put('q',"--.-");
  32. hm.put('r',".-.");
  33. hm.put('s',"...");
  34. hm.put('t',"-");
  35. hm.put('u',"..-");
  36. hm.put('v',"...-");
  37. hm.put('w',".--");
  38. hm.put('x',"-..-");
  39. hm.put('y',"-.--");
  40. hm.put('z',"--..");
  41. String ch = "f";
  42. for (char letter : User.toCharArray()) {
  43. for (char key : hm.keySet()) {
  44. if (letter == key) {
  45. System.out.print(hm.get(key));
  46. System.out.print(" ");
  47. }
  48. }
  49. }
  50. }
  51. }
Success #stdin #stdout 0.14s 322304KB
stdin
cd
stdout
-.-. -..