fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define el "\n"
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define se second
  7. #define fi first
  8. #define be begin()
  9. #define en end()
  10. #define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
  11.  
  12. int Count(char c1, char c2)
  13. {
  14. if(c1 >= 'A' && c1 <='Z') c1 -= 'A' - 'a';
  15. if(c2 >= 'A' && c2 <='Z') c2 -= 'A' - 'a';
  16. if(abs(c1 - c2) <= 1) return 0;
  17. else return c1 - c2 - 1;
  18. }
  19. int main()
  20. {
  21. Faster;
  22. char a, b; cin >> a >> b;
  23. cout << Count(a,b);
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0.01s 5288KB
stdin
d A
stdout
2