#include <iostream>
#include <cstdint>

void checkRepeatImpl(const char *word, uint64_t *tsar)
{
    if (*word) {
        tsar[*word++]++;
        checkRepeatImpl(word, tsar);  // Реку-ку-курсия. Хвостовая!
    }
}

bool checkRepeatImpl(const uint64_t *tsar, size_t idx = 0)
{
    return (idx < 256) && (tsar[idx] > 1 || checkRepeatImpl(tsar, idx + 1));
}

bool checkRepeat(const char *word)
{
    uint64_t tsar[256] = {};
    checkRepeatImpl(word, tsar);
    return checkRepeatImpl(tsar);
}

int main()
{
    std::cout << checkRepeat("") << std::endl      // 0
        << checkRepeat("a") << std::endl           // 0
        << checkRepeat("aa") << std::endl          // 1
        << checkRepeat("abc") << std::endl         // 0
        << checkRepeat("aaa") << std::endl         // 1
        << checkRepeat("bab") << std::endl         // 1
        << checkRepeat("baab") << std::endl        // 1
        << checkRepeat("bbaaabb") << std::endl     // 1
        << checkRepeat("bbabc") << std::endl       // 1
        << checkRepeat("abcbb") << std::endl;      // 1

    return EXIT_SUCCESS;
}
