#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  err(++it, args...);
}
const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 110;
const int MAXK = 110;
string s, t;
int f[26];
set<pair<int, int> > se;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> s >> t;
  for (int i = (0); i <= (25); i++) f[i] = -1;
  for (int i = (0); i <= (int((s).size()) - 1); i++)
    if (s[i] != t[i]) f[s[i] - 'a'] = t[i] - 'a';
  for (int i = (0); i <= (25); i++)
    if (f[i] != -1) {
      if (f[f[i]] == -1) {
        f[f[i]] = i;
      } else if (f[f[i]] != i) {
        cout << -1;
        return 0;
      }
    }
  for (int i = (0); i <= (int((s).size()) - 1); i++)
    if (f[s[i] - 'a'] != -1) s[i] = char(f[s[i] - 'a'] + 'a');
  if (s == t) {
    for (int i = (0); i <= (25); i++)
      if (f[i] != -1) {
        if (i < f[i])
          se.insert(pair<int, int>(i, f[i]));
        else
          se.insert(pair<int, int>(f[i], i));
      }
    cout << int((se).size()) << "\n";
    for (__typeof((se).begin()) it = (se).begin(); it != (se).end(); it++)
      cout << char(it->first + 'a') << ' ' << char(it->second + 'a') << "\n";
  } else
    cout << -1;
  return 0;
}
