#include "binstring.h"
#define MAX_QUERIES 1500

#include <iostream>
#include <cstdlib>
#include <cassert>

int _n, _cnt = 0;
std::string _s;

int compare_string(const std::string &s)
{
    std::cout << "compare_string: \n" << s << std::endl;
    _cnt++;

    if (s.size() != _s.size())
    {
        std::cout << "Invalid question" << std::endl;
        exit(0);
    }
    if (_cnt > MAX_QUERIES)
    {
        std::cout << "Question limit exceeded" << std::endl;
        exit(0);
    }

    int match = 0;
    for (int i = 0; i < (int)s.size(); ++ i)
    {
        if (s[i] < '0' or s[i] > '1')
        {
            std::cout << "Invalid question" << std::endl;
            exit(0);
        }
        if (s[i] == _s[i]) match++;
    }

    int ret = 0;
    if (match == _n / 2) ret = 1;
    if (match == _n) ret = 2;

    std::cout << "return value: " << ret << std::endl;
    return ret;
}

void submit_string(const std::string &s)
{
    std::cout << "submit_string: " << s << std::endl;
    if (s == _s) std::cout << "Correct answer with " << _cnt << " questions used" << std::endl;
    else
    {
        std::cout << "Wrong answer" << std::endl;
        std::cout << "Expected string: " << _s << std::endl;
    }
    exit(0);
}

int main()
{
    std::cin >> _s;
    _n = _s.size();
    assert(_n % 2 == 0);
    for (int i = 0; i < _n; ++ i) assert(_s[i] == '0' or _s[i] == '1');
    play(_n);
    return 0;
}
