[백준] 1919번 애너그램 만들기 (배열, C++)
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
반응형
'백준' 카테고리의 다른 글
[백준] 5397번 키로거 (리스트, c++) (0) | 2021.09.27 |
---|---|
[백준] 3273번 두 수의 합 (배열, 포인터 c++) (0) | 2021.09.24 |
1475번 방번호 (C++) (0) | 2021.09.24 |
[백준] 17298번 오큰수 (java, 스택) (0) | 2021.05.04 |
[백준] 2846번 오르막길 (java, 구현) (0) | 2021.05.02 |
TAGS.