#include #include using namespace std; int main(){ string N; cin >> N; int ans = N.size() - 1; bool ok = true; if (N[0] != '1'){ ok = false; } for (int i = 0; i < ans; i++){ if (N[i + 1] != '3'){ ok = false; } } if (ans == 0){ ok = false; } if (!ok){ cout << -1 << endl; } else { cout << ans << endl; } }