Advertisement
MladenPetrov

Message

Sep 23rd, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.84 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Messages {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         Integer input = Integer.parseInt(scanner.nextLine());
  8.  
  9.         int count = input;
  10.         while (input >= 0) {
  11.             input = Integer.parseInt(scanner.nextLine());
  12.             switch (input) {
  13.                 case 2:
  14.                     System.out.print("a");
  15.                     count--;
  16.                     break;
  17.                 case 22:
  18.                     System.out.print("b");
  19.                     count--;
  20.                     break;
  21.                 case 222:
  22.                     System.out.print("c");
  23.                     count--;
  24.                     break;
  25.                 case 3:
  26.                     System.out.print("d");
  27.                     count--;
  28.                     break;
  29.                 case 33:
  30.                     System.out.print("e");
  31.                     count--;
  32.                     break;
  33.                 case 333:
  34.                     System.out.print("f");
  35.                     count--;
  36.                     break;
  37.                 case 4:
  38.                     System.out.print("g");
  39.                     count--;
  40.                     break;
  41.                 case 44:
  42.                     System.out.print("h");
  43.                     count--;
  44.                     break;
  45.                 case 444:
  46.                     System.out.print("i");
  47.                     count--;
  48.                     break;
  49.                 case 5:
  50.                     System.out.print("j");
  51.                     count--;
  52.                     break;
  53.                 case 55:
  54.                     System.out.print("k");
  55.                     count--;
  56.                     break;
  57.                 case 555:
  58.                     System.out.print("l");
  59.                     count--;
  60.                     break;
  61.                 case 6:
  62.                     System.out.print("m");
  63.                     count--;
  64.                     break;
  65.                 case 66:
  66.                     System.out.print("n");
  67.                     count--;
  68.                     break;
  69.                 case 666:
  70.                     System.out.print("o");
  71.                     count--;
  72.                     break;
  73.                 case 7:
  74.                     System.out.print("p");
  75.                     count--;
  76.                     break;
  77.                 case 77:
  78.                     System.out.print("q");
  79.                     count--;
  80.                     break;
  81.                 case 777:
  82.                     System.out.print("r");
  83.                     count--;
  84.                     break;
  85.                 case 7777:
  86.                     System.out.print("s");
  87.                     count--;
  88.                     break;
  89.                 case 8:
  90.                     System.out.print("t");
  91.                     count--;
  92.                     break;
  93.                 case 88:
  94.                     System.out.print("u");
  95.                     count--;
  96.                     break;
  97.                 case 888:
  98.                     System.out.print("v");
  99.                     count--;
  100.                     break;
  101.                 case 9:
  102.                     System.out.print("w");
  103.                     count--;
  104.                     break;
  105.                 case 99:
  106.                     System.out.print("x");
  107.                     count--;
  108.                     break;
  109.                 case 999:
  110.                     System.out.print("y");
  111.                     count--;
  112.                     break;
  113.                 case 9999:
  114.                     System.out.print("z");
  115.                     count--;
  116.                     break;
  117.                 case 0:
  118.                     System.out.print(" ");
  119.                     count--;
  120.                     break;
  121.             }
  122.             if (count == 0) {
  123.                 return;
  124.             }
  125.         }
  126.     }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement