Advertisement
35657

Untitled

Oct 5th, 2024
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <fstream>
  6. #include <unordered_map>
  7.  
  8.  
  9. int main() {
  10.  
  11.     std::ifstream fin("input.txt");
  12.  
  13.     std::string str1, str2;
  14.  
  15.     fin >> str1 >> str2;
  16.  
  17.     std::unordered_map<char, int> abc;
  18.  
  19.     for (char ch : str1) {
  20.         abc[ch]++;
  21.     }
  22.  
  23.     for (char ch : str2) {
  24.         if (abc[ch] == 0) {
  25.             std::cout << ch;
  26.             break;
  27.         }
  28.         abc[ch]--;
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement