#include #define rep(i,a,b) for(int i=int(a);i> S; if(S.size() == 1 || S[0] != '1'){ cout << -1 << endl; return 0; } rep(i,0,S.size())if(S[i] != '3'){ cout << "-1" << endl; return 0; } cout << S.size() - 1 << endl; }