fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. bool isIncreasing(char cards[]) {
  6. int length = strlen(cards);
  7. for (int i = 2; i < length; i += 2) {
  8. char previousCard[3] = {cards[i - 2], cards[i - 1], 0};
  9. char currentCard[3] = {cards[i], cards[i + 1], 0};
  10. if (strcmp(currentCard, previousCard) < 0) {
  11. return false;
  12. }
  13. }
  14. return true;
  15. }
  16.  
  17. int main() {
  18. char cards[100];
  19. cin >> cards;
  20. cout << isIncreasing(cards);
  21. }
Success #stdin #stdout 0s 5288KB
stdin
8A2K
stdout
Standard output is empty