백준
[백준] 1919번 애너그램 만들기 (배열, C++)
해랑쓰
2021. 9. 24. 16:43
728x90
반응형
https://www.acmicpc.net/problem/1919
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int num[26];
int main(void) {
ios::sync_with_stdio(false);
cin.tie(NULL);
string s;
cin >> s;
for (auto c : s) {
num[c - 'a']++;
}
cin >> s;
for (auto c : s) {
num[c - 'a']--;
}
int ans = 0;
for (auto n : num) {
if (n != 0) {
ans += abs(n);
}
}
cout << ans;
return 0;
}
728x90
반응형