Click Here to go back to the homepage.

Detailed Differences Solution:


import java.util.*;
import java.math.*;

public class woo {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int cases = Integer.parseInt(sc.nextLine());
		for(int i = 0; i < cases; i++){
			StringBuilder sb = new StringBuilder();
			char[] str1 = sc.nextLine().toCharArray();
			char[] str2 = sc.nextLine().toCharArray();
			for(int j = 0; j < str1.length; j++){
				if(str1[j]==str2[j])
					sb.append(".");
				else
					sb.append("*");
			}
			for(char c: str1){
				System.out.print(c);
			}
			System.out.println();
			for(char c :str2){
				System.out.print(c);
			}
			System.out.println();
			System.out.println(sb);
			System.out.println();
		}
	}
}