[Boj]1919: 애너그램 만들기
2024. 8. 4. 18:36ㆍAlgorithm
1. problem :
https://www.acmicpc.net/problem/1919
2. solution 1 :
#include <bits/stdc++.h>
using namespace std;
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
int a[26] = {};
string str1, str2;
cin >> str1 >> str2;
for (auto c : str1) a[c - 'a']++;
for (auto c : str2) a[c - 'a']--;
int ans = 0;
for (int i : a) {
ans += abs(i);
}
cout << ans;
}
'Algorithm' 카테고리의 다른 글
[BOJ] 5397번 : 키로거 (0) | 2024.08.05 |
---|---|
[BOJ] 1406: 에디터 (0) | 2024.08.05 |
[Boj]11326:Strfry (0) | 2024.08.04 |
[Boj] 10807번 : 개수 세기 (0) | 2024.08.04 |
[Boj]3273번 : 두 수의 합 (0) | 2024.08.04 |