#include <bits/stdc++.h>
using namespace std;
int n;
string stra;
string strb;
char dict[500];
char dict2[500];
int main() {
  cin >> stra;
  cin >> strb;
  int lena = stra.size();
  for (char c = 'a'; c <= 'z'; c++) {
    dict[c] = c;
  }
  for (int i = 0; i < lena; i++) {
    dict[stra[i]] = strb[i];
    dict[strb[i]] = stra[i];
  }
  for (char c = 'a'; c <= 'z'; c++) {
    dict[dict[c]] = c;
  }
  for (int i = 0; i < lena; i++) {
    strb[i] = dict[strb[i]];
  }
  if (stra != strb) {
    cout << -1 << endl;
  } else {
    int ansa = 0;
    for (char c = 'a'; c <= 'z'; c++) {
      if (dict[c] != c && dict[c] < c) {
        ansa++;
      }
    }
    cout << ansa << endl;
    for (char c = 'a'; c <= 'z'; c++) {
      if (dict[c] != c && dict[c] < c) {
        cout << dict[c] << " " << c << endl;
      }
    }
  }
  return 0;
}
