Created
July 29, 2017 03:35
-
-
Save chanjungkim/270f221482155fe0c51ab9e5ef88faf3 to your computer and use it in GitHub Desktop.
1120
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
public class Main{ | |
public static void main(String[] args) throws IOException{ | |
Scanner sc = new Scanner(System.in); | |
String a = sc.next(); | |
String b = sc.next(); | |
int lenA = a.length(); | |
int lenB = b.length(); | |
int count = 0; | |
if( a.length() == lenB){ | |
for(int i = 0 ; i < lenB; i++){ | |
if(a.charAt(i)!=b.charAt(i)){ | |
count++; | |
} | |
} | |
} else{ | |
for(int i = 0 ; i < lenA ; i++) { | |
if(a.charAt(i)!=b.charAt((int)(Math.ceil((lenB-lenA)/2))+i+1)){ | |
count++; | |
// System.out.println("a.char: "+a.charAt(i)+" b.char: "+b.charAt((int)(Math.ceil((lenB-lenA)/2))+i+1)+" n: "+count); | |
} | |
} | |
} | |
System.out.println(count); | |
sc.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment