Advertisement
Ronaldoztupang

Jawaban Jojo si Penulis 1

Oct 23rd, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3.  
  4. public class Solution {
  5.  
  6.     public static void main(String[] args) {
  7.      String s1,s2;
  8.     Scanner masuk = new Scanner(System.in);
  9.     s1 = masuk.nextLine();
  10.     s2 = masuk.nextLine();
  11.     int x1=s1.length(), x2=s2.length();
  12.     if (x1>20||x2>20)
  13.         {
  14.             System.out.print("ERROR");
  15.         }
  16.     else if ( x1==x2)
  17.         {
  18.             System.out.print("SAMA");
  19.         }
  20.     else if (x1<x2)
  21.         {
  22.             x1 = x2-x1;
  23.             for (int j=1; j<=x1;j++)
  24.             {
  25.                 s1 = " " +s1;
  26.             }
  27.             System.out.println(s1);
  28.             System.out.print(s2);
  29.         }
  30.         else
  31.         {
  32.             x1 = x1-x2;
  33.             for (int j=1; j<=x1;j++)
  34.             {
  35.                 s2 = " "+s2;
  36.             }
  37.             System.out.println(s1);
  38.             System.out.print(s2);
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement