Skip to content

Instantly share code, notes, and snippets.

@chanjungkim
Created July 29, 2017 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chanjungkim/270f221482155fe0c51ab9e5ef88faf3 to your computer and use it in GitHub Desktop.
Save chanjungkim/270f221482155fe0c51ab9e5ef88faf3 to your computer and use it in GitHub Desktop.
1120
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