Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int value (char number)
  5. {
  6. int v = tolower(number);
  7. if (v == 'a') return 1;
  8. if (v == 'b') return 2;
  9. if (v == 'c') return 3;
  10. if (v == 'd') return 4;
  11. if (v == 'e') return 5;
  12. if (v == 'f') return 6;
  13. if (v == 'g') return 7;
  14. if (v == 'h') return 8;
  15. if (v == 'i') return 9;
  16. if (v == 'j') return 10;
  17. if (v == 'k') return 11;
  18. if (v == 'l') return 12;
  19. if (v == 'm') return 13;
  20. if (v == 'n') return 14;
  21. if (v == 'o') return 15;
  22. if (v == 'p') return 16;
  23. if (v == 'q') return 17;
  24. if (v == 'r') return 18;
  25. if (v == 's') return 19;
  26. if (v == 't') return 20;
  27. if (v == 'u') return 21;
  28. if (v == 'v') return 22;
  29. if (v == 'w') return 23;
  30. if (v == 'x') return 24;
  31. if (v == 'y') return 25;
  32. if (v == 'z') return 26;
  33. }
  34. int main ()
  35. {
  36. char string1 [256];
  37. char string2 [256];
  38.  
  39. scanf("%s", string1);
  40. scanf("%s", string2);
  41.  
  42. int i , p1 = 0 , p2 = 0 , a , b ;
  43. int tam = strlen (string1);
  44.  
  45. for (i = 0 ; i < tam ; i++)
  46. {
  47. a = value (string1[i]);
  48. b = value (string2[i]);
  49.  
  50. if (a > b) p1++ ;
  51. if (a < b) p2++ ;
  52. }
  53.  
  54. if (p1 == p2) printf("0\n");
  55. if (p1 > p2) printf("1\n");
  56. if (p1 < p2) printf("-1\n");
  57.  
  58. return 0 ;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement