#include <bits/stdc++.h>
using namespace std;
template <typename T>
T next_int() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') {
    p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return p * x;
}
string next_token() {
  char ch;
  string ans = "";
  do {
    ch = getchar();
  } while (ch <= ' ');
  while (ch > ' ') {
    ans += ch;
    ch = getchar();
  }
  return ans;
}
const long long INF = (long long)1e18;
const int INFINT = (int)1e9 + 227 + 1;
const int MAXN = (int)1e6 + 227 + 1;
const int MOD = (int)1e9 + 7;
const long double EPS = 1e-9;
long long bin_pow(long long a, long long b) {
  if (!b) return 1;
  long long ans = bin_pow(a, b / 2);
  ans = ans * ans;
  if (b % 2) ans = ans * a;
  return ans;
}
char c[26];
int main() {
  for (int i = 0; i < 26; i++) c[i] = '?';
  string a = next_token();
  string b = next_token();
  int n = a.size();
  set<pair<char, char> > q;
  for (int i = 0; i < n; i++) {
    if (a[i] != b[i]) q.insert(make_pair(min(a[i], b[i]), max(a[i], b[i])));
    if (c[a[i] - 'a'] == '?' || c[a[i] - 'a'] == b[i])
      c[a[i] - 'a'] = b[i];
    else {
      puts("-1");
      return 0;
    }
    if (c[b[i] - 'a'] == '?' || c[b[i] - 'a'] == a[i])
      c[b[i] - 'a'] = a[i];
    else {
      puts("-1");
      return 0;
    }
  }
  cout << q.size() << "\n";
  for (set<pair<char, char> >::iterator i = q.begin(); i != q.end(); i++)
    cout << (*i).first << " " << (*i).second << "\n";
}
