#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  char c;
  vector<pair<char, char>> a;
  for (int i = 0; i < n; i++)
    if (s[i] != t[i]) {
      c = t[i];
      for (int j = 0; j < n; j++)
        if (t[j] == c && s[j] == s[i] || t[j] == s[i] && s[j] == c) {
          if (t[j] == c)
            t[j] = s[i];
          else
            t[j] = c;
        } else if (t[j] == c || s[j] == s[i] || t[j] == s[i] || s[j] == c) {
          cout << -1;
          return 0;
        }
      a.push_back(make_pair(c, s[i]));
    }
  cout << a.size() << endl;
  for (int i = 0; i < a.size(); i++)
    cout << a[i].first << " " << a[i].second << endl;
  return 0;
}
