#include <bits/stdc++.h>
using namespace std;
string s, t;
int n, pai[27];
int conv(char k) { return k - 'a' + 1; }
char conv2(int m) { return m + 'a' - 1; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> t;
  int len = s.length();
  bool can = true;
  for (int i = 0; i < len; i++) {
    int a = conv(s[i]);
    int b = conv(t[i]);
    if ((pai[a] == 0 && pai[b] == 0) || (pai[a] == b && pai[b] == a)) {
      pai[a] = b;
      pai[b] = a;
    } else {
      can = 0;
      break;
    }
  }
  if (can) {
    set<pair<int, int>> st;
    for (int i = 1; i <= 26; i++) {
      if (pai[i] != i && pai[i] != 0) {
        st.insert({min(i, pai[i]), max(i, pai[i])});
      }
    }
    cout << st.size() << '\n';
    for (auto x : st) {
      cout << conv2(x.first) << " " << conv2(x.second) << '\n';
    }
  } else {
    cout << -1;
  }
  return 0;
}
