#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cout.tie(0);
  string s, t, b;
  int n;
  vector<pair<char, char>> v;
  set<char> z;
  bool fine = false;
  char a[26];
  for (int i = 0; i < 26; i++) a[i] = '@';
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++)
    if (a[s[i] - 'a'] == '@')
      a[s[i] - 'a'] = t[i];
    else if (a[s[i] - 'a'] != t[i]) {
      cout << -1;
      return 0;
    }
  for (int i = 0; i < 26; i++)
    if (a[i] != '@') {
      if (((char)(i + 'a') != a[a[i] - 'a']) && ('@' != a[a[i] - 'a'])) {
        cout << -1;
        return 0;
      }
    }
  for (int i = 0; i < 26; i++)
    if ((a[i] != (char)('a' + i)) && (a[i] != '@')) {
      fine = false;
      for (int j = 0; j < v.size(); j++)
        if ((v[j].first == a[i]) && (v[j].second == (char)('a' + i)))
          fine = true;
      if (fine == false) v.push_back(make_pair((char)('a' + i), a[i]));
    }
  for (int i = 0; i < v.size(); i++) z.insert(v[i].second);
  if (z.size() != v.size()) {
    cout << -1;
    return 0;
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
