/******************************************************* * cattle_train -- yukicoder うし数列 * 2019/07/7 kamato02 *******************************************************/ #include char cattle_train[103]; int main() { int i; int count = 0; scanf("%s",cattle_train); if(cattle_train[0] != '1') { printf("-1"); return (0); } for(i = 1;cattle_train[i] != '\0';i++) { if(cattle_train[i] == '3') { count++; } else { printf("-1"); return (0); } } printf("%d",count); return (0); }