Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class new6 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String input = scan.nextLine();
- int points = 0;
- int pointsSecondGuy = 0;
- String firstName = " ";
- String secondName = " ";
- while (!input.equals("Stop")) {
- for (int i = 0; i < input.length(); i++) {
- int num = Integer.parseInt(scan.nextLine());
- if (num == input.charAt(i)) {
- points += 10;
- } else {
- points += 2;
- }
- firstName = input;
- }
- input = scan.nextLine();
- for (int i = 0; i < input.length(); i++) {
- int num = Integer.parseInt(scan.nextLine());
- if (num == input.charAt(i)) {
- pointsSecondGuy += 10;
- } else {
- pointsSecondGuy += 2;
- }
- secondName = input;
- }
- input = scan.nextLine();
- }
- if (points > pointsSecondGuy) {
- System.out.printf("The winner is %s with %d points!",firstName,points);
- } else if (points < pointsSecondGuy) {
- System.out.printf("The winner is %s with %d points!",secondName,pointsSecondGuy);
- } else if (points == pointsSecondGuy) {
- System.out.printf("The winner is %s with %d points!",secondName,pointsSecondGuy);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement