Advertisement
dllbridge

Untitled

Nov 24th, 2022
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. string a, b;
  5.  
  6. int main()
  7. {
  8.    
  9.     cin >> a >> b;
  10.  
  11.     for(int i = 0; i < a.size(); i++)
  12.     {
  13.              if(a[i] == '0' && b[i] == '1') a[i] = '1';
  14.         else if(a[i] == '1' && b[i] == '0') a[i] = '1';
  15.         else if(a[i] == '0' && b[i] == '0') a[i] = '0';
  16.         else if(a[i] == '1' && b[i] == '1') a[i] = '0';
  17.     }
  18.    
  19.     cout << a;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement