Skip to content

Commit

Permalink
feat(4.4.3): Finish U4_L4_Activity_Three
Browse files Browse the repository at this point in the history
  • Loading branch information
101zh committed Nov 1, 2023
1 parent e1689c2 commit 215aa64
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main/java/Unit4/U4_L4_Activity_Three.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package Unit4;

import java.util.Scanner;

public class U4_L4_Activity_Three {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

String word1 = scanner.nextLine();
String word2 = scanner.nextLine();

if (word1.length() == word2.length()) {

for (int i = word1.length(); i > 0; i--) {
System.out.print(word2.substring(i - 1, i));
System.out.print(word1.substring(i - 1, i));
}

} else {
System.out.println("error");
}

scanner.close();
}
}

0 comments on commit 215aa64

Please sign in to comment.