Advertisement
sazid_iiuc

766d2a

Jun 21st, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. main()
  5. {
  6.     string first_str, second_str;
  7.  
  8.     cin >> first_str >> second_str;
  9.  
  10.     int count = max(first_str.size(), second_str.size()), temp;
  11.  
  12.     temp = count;
  13.  
  14.     for (int i = 0; i < first_str.size(); i++)
  15.     {
  16.         for (int j = 0; j < second_str.size(); j++)
  17.         {
  18.             if (first_str[i] == second_str[j])
  19.             {
  20.                 temp--;
  21.                 break;
  22.             }
  23.         }
  24.         if(temp < count)
  25.         {
  26.             break;
  27.         }
  28.     }
  29.  
  30.     if (temp <= 0)
  31.     {
  32.         count = -1;
  33.     }
  34.  
  35.     cout << count;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement