#include <iostream>
#include <cstring>
using namespace std;

bool isIncreasing(char cards[]) {
    int length = strlen(cards);
    for (int i = 2; i < length; i += 2) {
        char previousCard[3] = {cards[i - 2], cards[i - 1], 0};
        char currentCard[3] = {cards[i], cards[i + 1], 0};
        if (strcmp(currentCard, previousCard) < 0) {
            return false;
        }
    }
    return true;
}

int main() {
    char cards[100];
    cin >> cards;
    cout << isIncreasing(cards);
}