#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
const long double pi = 3.14159265359;
const int INF = 1e9 + 7;
string s, t;
map<char, char> change;
map<char, int> hmm;
vector<pair<char, char> > ans;
int main() {
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i] && hmm[s[i]] == 0) {
      hmm[s[i]] = 1;
      hmm[t[i]] = 1;
      change[s[i]] = t[i];
      change[t[i]] = s[i];
      ans.push_back(make_pair(s[i], t[i]));
    }
  }
  for (int i = 0; i < t.size(); i++) {
    if (!hmm[t[i]]) {
      continue;
    }
    t[i] = change[t[i]];
  }
  if (t != s) {
    cout << -1;
    return 0;
  }
  cout << ans.size() << '\n';
  for (auto i : ans) {
    cout << i.first << ' ' << i.second << '\n';
  }
}
