답안
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static int[] getAlphabetCount(String str) {
int[] count = new int[26];
for (int i=0; i<str.length(); i++)
count[str.charAt(i) - 'a']++;
return count;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String a = sc.next();
String b = sc.next();
int[] countA = getAlphabetCount(a);
int[] countB = getAlphabetCount(b);
int ans = 0;
for (int i=0; i<26; i++)
ans += Math.abs(countA[i] - countB[i]);
System.out.println(ans);
}
}
'백준 문제풀이 > 못 푼 문제' 카테고리의 다른 글
[백준 13223] 소금 폭탄 (0) | 2024.02.18 |
---|---|
[백준 1157] 단어 공부 (0) | 2024.02.18 |