/* -*- coding: utf-8 -*- * * 791.cc: No.791 うし数列 - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ /* typedef */ /* global variables */ char s[128]; /* subroutines */ /* main */ int main() { scanf("%s", s); if (s[0] != '1') { puts("-1"); return 0; } int k = 0; while (s[k + 1] == '3') k++; printf("%d\n", (k > 0 && s[k + 1] == '\0') ? k : -1); return 0; }