public static void main ( String [ ] args ) {
  Scanner in = new Scanner ( System . in ) ;
  String str1 = in . next ( ) ;
  String str2 = in . next ( ) ;
  char c1 , c2 ;
  int a1 , a2 ;
  int ansSum = 0 ;
  int arr [ ] = new int [ 26 ] ;
  for ( int i = 0 ;
  i < 26 ;
  i ++ ) {
    arr [ i ] = - 1 ;
  }
  in . close ( ) ;
  for ( int i = 0 ;
  i < str1 . length ( ) ;
  i ++ ) {
    c1 = str1 . charAt ( i ) ;
    c2 = str2 . charAt ( i ) ;
    a1 = ( int ) c1 - 97 ;
    a2 = ( int ) c2 - 97 ;
    if ( ( arr [ a2 ] != a1 || arr [ a1 ] != a2 ) && ( arr [ a1 ] != - 1 || arr [ a2 ] != - 1 ) ) {
      System . out . println ( - 1 ) ;
      return ;
    }
    else if ( a1 == a2 ) {
      arr [ a1 ] = a1 ;
    }
    else if ( arr [ a1 ] == - 1 && arr [ a2 ] == - 1 ) {
      arr [ a1 ] = a2 ;
      arr [ a2 ] = a1 ;
      ansSum ++ ;
    }
  }
  System . out . println ( ansSum ) ;
  for ( int i = 0 ;
  i < 26 ;
  i ++ ) {
    if ( arr [ i ] != - 1 && arr [ i ] != arr [ arr [ i ] ] ) {
      System . out . println ( ( char ) ( arr [ i ] + 97 ) + " " + ( char ) ( arr [ arr [ i ] ] + 97 ) ) ;
      arr [ arr [ i ] ] = - 1 ;
      arr [ i ] = - 1 ;
    }
  }
}

public static void main ( String [ ] args ) { Scanner in = new Scanner ( System . in ) ; String str1 = in . next ( ) ; String str2 = in . next ( ) ; char c1 , c2 ; int a1 , a2 ; int ansSum = 0 ; int arr [ ] = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { arr [ i ] = - 1 ; } in . close ( ) ; for ( int i = 0 ; i < str1 . length ( ) ; i ++ ) { c1 = str1 . charAt ( i ) ; c2 = str2 . charAt ( i ) ; a1 = ( int ) c1 - 97 ; a2 = ( int ) c2 - 97 ; if ( ( arr [ a2 ] != a1 || arr [ a1 ] != a2 ) && ( arr [ a1 ] != - 1 || arr [ a2 ] != - 1 ) ) { System . out . println ( - 1 ) ; return ; } else if ( a1 == a2 ) { arr [ a1 ] = a1 ; } else if ( arr [ a1 ] == - 1 && arr [ a2 ] == - 1 ) { arr [ a1 ] = a2 ; arr [ a2 ] = a1 ; ansSum ++ ; } } System . out . println ( ansSum ) ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( arr [ i ] != - 1 && arr [ i ] != arr [ arr [ i ] ] ) { System . out . println ( ( char ) ( arr [ i ] + 97 ) + " ▁ " + ( char ) ( arr [ arr [ i ] ] + 97 ) ) ; arr [ arr [ i ] ] = - 1 ; arr [ i ] = - 1 ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) 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: (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)) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier)) declarator: (variable_declarator name: (identifier))) (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) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (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)) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (cast_expression type: (integral_type) value: (identifier)) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (cast_expression type: (integral_type) value: (identifier)) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal))))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal))))) (return_statement)) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (update_expression (identifier))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) (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)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier)))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) right: (string_literal)) right: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))) right: (decimal_integer_literal)))))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))) right: (unary_expression operand: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal))))))))))