Nathan Coulas

CCC '11 S2 - Multiple Choice

ccc11s2 JAVA8 06 Nov, 2019 1.859s 5 points

Source Code

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        
           Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        String qa = "";
        int score = 0;
        for(int i = 0; i < (num * 2) + 1; i++){
            qa += in.nextLine();
        }
        
        
        String q = "";
        String a = "";
        
        for(int i = 0; i < num; i++){
            q += Character.toString(qa.charAt(i));
            a += Character.toString(qa.charAt(i + num));
        }
        
            for(int i = 0; i < num; i++){
                if(q.charAt(i) == a.charAt(i)){
                    score++;
                }
            }
        
            System.out.println(score);
             
 
    }
  
    
}