35657

Untitled

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