#include #include #include int main() { std::string s; std::cin >> s; decltype(s)::iterator ite = s.begin(); char& c = *ite; try { if (c != '1') throw -1; else if (s.length() == 1) throw -1; ite++; for (; ite != s.end(); ite++) { c = *ite; if (c != '3') throw -1; } throw (int) (s.length()-1); } catch (int e) { std::cout << e << std::endl; } }