public static void main ( String args [ ] ) {
  Scanner in = new Scanner ( System . in ) ;
  String s = in . next ( ) ;
  int h = Integer . valueOf ( s . substring ( 0 , 2 ) ) ;
  int m = Integer . valueOf ( s . substring ( 3 , 5 ) ) ;
  int rev = 0 ;
  int temp = h ;
  if ( h >= 16 && h <= 19 ) {
    h = 20 ;
    System . out . println ( h / 10 + "" + h % 10 + ":" + h % 10 + "" + h / 10 ) ;
  }
  else if ( h >= 6 && h <= 9 ) {
    h = 10 ;
    System . out . println ( h / 10 + "" + h % 10 + ":" + h % 10 + "" + h / 10 ) ;
  }
  else {
    for ( int i = 0 ;
    i < 2 ;
    i ++ , temp = temp / 10 ) rev = rev * 10 + temp % 10 ;
    if ( m < rev ) {
      h = ( h >= 16 && h <= 19 ) ? 20 : h ;
      System . out . println ( h / 10 + "" + h % 10 + ":" + h % 10 + "" + h / 10 ) ;
    }
    else {
      h = ( h + 1 != 24 ) ? h + 1 : 0 ;
      h = ( h >= 16 && h <= 19 ) ? 20 : h ;
      System . out . println ( h / 10 + "" + h % 10 + ":" + h % 10 + "" + h / 10 ) ;
    }
  }
}

public static void main ( String args [ ] ) { Scanner in = new Scanner ( System . in ) ; String s = in . next ( ) ; int h = Integer . valueOf ( s . substring ( 0 , 2 ) ) ; int m = Integer . valueOf ( s . substring ( 3 , 5 ) ) ; int rev = 0 ; int temp = h ; if ( h >= 16 && h <= 19 ) { h = 20 ; System . out . println ( h / 10 + " " + h % 10 + " : " + h % 10 + " " + h / 10 ) ; } else if ( h >= 6 && h <= 9 ) { h = 10 ; System . out . println ( h / 10 + " " + h % 10 + " : " + h % 10 + " " + h / 10 ) ; } else { for ( int i = 0 ; i < 2 ; i ++ , temp = temp / 10 ) rev = rev * 10 + temp % 10 ; if ( m < rev ) { h = ( h >= 16 && h <= 19 ) ? 20 : h ; System . out . println ( h / 10 + " " + h % 10 + " : " + h % 10 + " " + h / 10 ) ; } else { h = ( h + 1 != 24 ) ? h + 1 : 0 ; h = ( h >= 16 && h <= 19 ) ? 20 : h ; System . out . println ( h / 10 + " " + h % 10 + " : " + h % 10 + " " + h / 10 ) ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) alternative: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) update: (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (ternary_expression condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (decimal_integer_literal) alternative: (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (ternary_expression condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (binary_expression left: (identifier) right: (decimal_integer_literal)) alternative: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (ternary_expression condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (decimal_integer_literal) alternative: (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (string_literal)) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))))))))))