Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     char first[2], second[2];
  7.  
  8.     cin>>first>>second;
  9.  
  10.     int i,count=0;
  11.  
  12.     i= strlen(first);
  13.  
  14.     for(int n=0; n<i; n++)
  15.     {
  16.        
  17.         if(first[n]!=second[n])
  18.         {
  19.             if(first[n]!=second[n]+32||first[n]!=second[n]-32)
  20.             {
  21.                 if(first[n]<91 && second[n]<91)
  22.                 {
  23.                     count=count+first[n]-second[n];
  24.                 }
  25.                 else if(first[n]>96 && second[n]>96)
  26.                 {
  27.                     count=count+first[n]-second[n];
  28.                 }
  29.                 else if (first[n]>96 && second[n]<91)
  30.                 {
  31.                     second[n]=second[n]+32;
  32.                     count=count+first[n]-second[n];
  33.                 }
  34.                 else if (first[n]<91 && second[n]>96)
  35.                 {
  36.                     first[n]=first[n]+32;
  37.                     count=count+first[n]-second[n];
  38.                 }
  39.                
  40.                
  41.             }
  42.         }
  43.     }
  44.     cout<<count;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement