#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
vector<int> v[26];
int main() {
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.size(); i++) {
    v[s[i] - 'a'].push_back(t[i] - 'a');
    v[t[i] - 'a'].push_back(s[i] - 'a');
  }
  set<pair<char, char> > ss;
  for (int i = 0; i < 26; i++) {
    set<int> sa;
    for (int j = 0; j < v[i].size(); j++) sa.insert(v[i][j]);
    if (sa.size() > 1) return 0 * printf("-1\n");
    char c, d;
    for (int j = 0; j < v[i].size(); j++) {
      c = char(i + 'a');
      d = char(v[i][j] + 'a');
      if (c > d) swap(c, d);
      if (c != d) ss.insert({c, d});
    }
  }
  cout << ss.size() << endl;
  for (auto it = ss.begin(); it != ss.end(); it++)
    cout << it->first << " " << it->second << endl;
  return 0;
}
