Skip to content

Instantly share code, notes, and snippets.

Created December 20, 2016 07:04
public class Main {
public static void main(String[] args) {
Scanner sc1 = new Scanner(System.in);
System.out.println("Enter first string: ");
String str1 = sc1.nextLine();
System.out.println("Enter second string of same length: ");
String str2 = sc1.nextLine();
System.out.println(str1);
String clear = "";
for (int i = 0; i < str1.length(); i++) {
clear = clear + str2.charAt(i);
if (str2.charAt(i) != (str1.charAt(i))) {
System.out.println(clear + str1.substring(i + 1));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment