#include <bits/stdc++.h>
using namespace std;
int n, m, k, i, j;
string s, t;
vector<pair<char, char> > my;
map<char, int> used;
int main() {
  cin >> s >> t;
  n = s.size();
  for (i = 0; i < n; i++) {
    char x, y;
    k = 0;
    x = t[i];
    y = s[i];
    if (x != y) {
      for (j = 0; j < n; j++) {
        if (y == t[j] && x == s[j] && used[x] == false && used[y] == false) {
          used[x] = true;
          used[y] = true;
          for (int l = 0; l < n; l++) {
            if (t[l] == y) {
              t[l] = x;
            } else if (t[l] == x) {
              t[l] = y;
            }
          }
          my.push_back(make_pair(y, x));
          k = 1;
          break;
        }
      }
      if (k == 0 && !used[y] && !used[x]) {
        used[y] = true;
        used[x] = true;
        my.push_back(make_pair(t[i], s[i]));
        for (j = 0; j < n; j++) {
          if (t[j] == x) {
            t[j] = y;
          } else if (t[j] == y)
            t[j] = x;
        }
      }
    }
  }
  if (s != t) {
    cout << -1;
    return 0;
  }
  cout << my.size() << endl;
  for (i = 0; i < my.size(); i++) {
    cout << my[i].first << " " << my[i].second << endl;
  }
}
