#include <bits/stdc++.h>
using namespace std;
map<char, char> check;
map<char, char> check2;
map<char, int> check3;
int main() {
  string s1, s2, s3;
  char a, b;
  int curans = 0;
  cin >> s1 >> s2;
  s3 = s2;
  for (int i = 0; i < s2.length(); i++) {
    if (s2[i] != s1[i]) {
      if (check[s1[i]] < (int)'a' && check2[s1[i]] < (int)'a') {
        check[s1[i]] = s2[i];
        check2[s2[i]] = s1[i];
        ++curans;
      }
    }
  }
  for (int i = 0; i < s2.length(); ++i) {
    if (check2[s2[i]] >= 'a')
      s2[i] = check2[s2[i]];
    else if (check[s2[i]] >= 'a')
      s2[i] = check[s2[i]];
  }
  if (s2 != s1) {
    puts("-1");
    return 0;
  }
  if (curans == 0) {
    puts("0");
    return 0;
  } else {
    cout << curans << endl;
    for (int i = 'a'; i <= 'z'; ++i) {
      if (check2[i] >= 'a') {
        cout << (char)i << " " << check2[i] << endl;
      }
    }
  }
}
