Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TextPlocessing.Exercise;
- import java.util.Scanner;
- public class O2CharacterMultiplier {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String[] input = scanner.nextLine().split(" ");
- int sum = 0;
- String first = input[0], second = input[1];
- if (first.length() > second.length()) {
- first = input[1];
- second = input[0];
- }
- for (int i = 0; i < first.length(); i++) {
- sum += first.charAt(i) * second.charAt(i);
- }
- for (int a = first.length(); a < second.length(); a++) {
- sum += second.charAt(a);
- }
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment