public static void main ( String [ ] args ) throws IOException {
  String sr = br . readLine ( ) ;
  char [ ] arr = sr . toCharArray ( ) ;
  int i = sr . length ( ) - 1 ;
  int count = 0 ;
  while ( i > 0 ) {
    if ( arr [ i ] == '0' ) {
      count ++ ;
    }
    else {
      int j = i - 1 ;
      while ( j >= 0 && arr [ j ] != '0' ) {
        arr [ j ] = '0' ;
        j -- ;
      }
      count = count + 2 ;
      if ( j >= 0 ) arr [ j ] = 1 ;
      else {
        count += i ;
        System . out . println ( count ) ;
        return ;
      }
    }
    i -- ;
  }
  if ( arr [ 0 ] == '0' ) count ++ ;
  System . out . println ( count ) ;
}

public static void main ( String [ ] args ) throws IOException { String sr = br . readLine ( ) ; char [ ] arr = sr . toCharArray ( ) ; int i = sr . length ( ) - 1 ; int count = 0 ; while ( i > 0 ) { if ( arr [ i ] == '0' ) { count ++ ; } else { int j = i - 1 ; while ( j >= 0 && arr [ j ] != '0' ) { arr [ j ] = '0' ; j -- ; } count = count + 2 ; if ( j >= 0 ) arr [ j ] = 1 ; else { count += i ; System . out . println ( count ) ; return ; } } i -- ; } if ( arr [ 0 ] == '0' ) count ++ ; System . out . println ( count ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (block (expression_statement (update_expression (identifier)))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) (expression_statement (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (return_statement))))) (expression_statement (update_expression (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (character_literal))) consequence: (expression_statement (update_expression (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))