Skip to content

Instantly share code, notes, and snippets.

@enif-lee
Created January 1, 2017 12:32
Show Gist options
  • Save enif-lee/7bd8981f7ff9fa521b76f837cd4951eb to your computer and use it in GitHub Desktop.
Save enif-lee/7bd8981f7ff9fa521b76f837cd4951eb to your computer and use it in GitHub Desktop.
package problem.boj;
import java.util.Scanner;
/**
* Created by Jinseoung on 2017-01-01.
*/
public class ValueToAnagram {
static Scanner sc = new Scanner(ClassLoader.getSystemResourceAsStream("problem/boj/ValueToAnagram.testcase"));
public static void main(String[] args) {
String s1 = sc.next(),
s2 = sc.next();
int countValue = 0;
int[] charactors = new int[58];
for(int i = 0; i < s1.length(); i++) {
charactors[s1.charAt(i)-'A']++;
}
for(int i = 0; i < s2.length(); i++) {
charactors[s2.charAt(i)-'A']--;
}
for(int i = 0; i < charactors.length; i++) countValue += Math.abs(charactors[i]);
System.out.println(countValue);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment