Advertisement
Dang_Quan_10_Tin

HOHANG TS10 Da Nang 2017-2018

Jan 7th, 2022
784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #define task "HOHANG"
  2.  
  3. #include <iostream>
  4. #include <cstdio>
  5.  
  6. using namespace std;
  7.  
  8. using ll = long long;
  9. using ld = long double;
  10.  
  11. constexpr int N = 1e5 + 5;
  12. string S1, S2;
  13. int cntS1[30], cntS2[30];
  14.  
  15. void Read()
  16. {
  17.     cin >> S1 >> S2;
  18. }
  19.  
  20. void Solve()
  21. {
  22.     for (auto i : S1)
  23.         ++cntS1[i - 'a'];
  24.     for (auto i : S2)
  25.         ++cntS2[i - 'a'];
  26.  
  27.     int ans(0);
  28.  
  29.     for (int i = 0; i < 26; ++i)
  30.         if ((cntS1[i] > 0) != (cntS2[i] > 0))
  31.             ans += cntS1[i] + cntS2[i];
  32.  
  33.     cout << ans;
  34. }
  35.  
  36. int32_t main()
  37. {
  38.     ios::sync_with_stdio(0);
  39.     cin.tie(0);
  40.     cout.tie(0);
  41.     if (fopen(task ".INP", "r"))
  42.     {
  43.         freopen(task ".INP", "r", stdin);
  44.         freopen(task ".OUT", "w", stdout);
  45.     }
  46.  
  47.     Read();
  48.     Solve();
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement