Advertisement
thedigletdistroyer

Untitled

Feb 5th, 2023
654
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int a,b,a1,b1,n,S1,S2;
  5. int main()
  6. {
  7.     cin>>a>>b;
  8.     S1=S2=0;
  9.     a1=a;
  10.     b1=b;
  11.     while(a!=0)
  12.     {
  13.         S1=S1+1;
  14.         a=a/10;
  15.     }
  16.     while(b!=0)
  17.     {
  18.         S2=S2+1;
  19.         b=b/10;
  20.     }
  21.     if(S1!=S2)
  22.     {
  23.         cout<<"NU";
  24.     }
  25.     else
  26.     {
  27.         while(a1!=0 && b1!=0)
  28.         {
  29.             if(a1%10==b1%10)
  30.             {
  31.                 n++;
  32.             }
  33.             a1=a1/10;
  34.             b1=b1/10;
  35.         }
  36.         cout <<"DA"<<endl<<n;
  37.     }
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement