#include <bits/stdc++.h>
using namespace std;
const long long maxn = 300010;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long INF = 2e9;
const long long LINF = 4e18;
long long n, m, x, y, l, r, k, q;
map<char, char> M, N;
string s, ss;
set<char> S;
set<pair<char, char> > SS;
void solve() {
  cin >> s >> ss;
  for (auto u : s) N[u] = 'Z';
  string x = "";
  bool ok = true;
  for (char y = 'a'; y <= 'z'; y++) M[y] = '!';
  for (long long i = 0; i < s.size(); i++) {
    if (M[s[i]] == '!' or M[s[i]] == ss[i])
      M[s[i]] = ss[i];
    else
      ok = false;
  }
  if (!ok) {
    cout << -1;
    return;
  }
  for (long long i = 0; i < s.size(); i++) {
    if (M[M[s[i]]] == '!')
      x += s[i];
    else
      x += M[M[s[i]]];
  }
  if (x == s) {
    vector<pair<char, char> > v;
    bool ok = true;
    for (char y = 'a'; y <= 'z'; y++) {
      if (N[y] != 'Z') continue;
      if (M[y] == y) continue;
      if (N[M[y]] == 'Z' and M[M[y]] == y) {
        if (SS.count({y, M[y]})) continue;
        v.push_back({y, M[y]});
        SS.insert({y, M[y]});
        SS.insert({M[y], y});
      } else if (M[M[y]] == '!') {
        if (S.count(M[y])) {
          ok = false;
          break;
        }
        if (SS.count({y, M[y]})) continue;
        v.push_back({y, M[y]});
        SS.insert({y, M[y]});
        SS.insert({M[y], y});
        S.insert(M[y]);
      }
    }
    if (!ok) {
      cout << -1;
      return;
    }
    cout << v.size() << "\n";
    for (auto u : v) cout << u.first << " " << u.second << "\n";
  } else
    cout << -1;
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long t = 1;
  while (t--) solve();
}
