#include <bits/stdc++.h>
using namespace std;
map<char, char> chaves;
int main() {
  string normal;
  string trocada;
  cin >> normal;
  cin >> trocada;
  vector<pair<char, char> > res;
  int cont = 0;
  for (int i = 0; i < normal.size(); i++) {
    if (int(chaves[normal[i]]) == 0 && int(chaves[trocada[i]]) == 0) {
      if (normal[i] == trocada[i]) {
        cont++;
      }
      chaves[normal[i]] = trocada[i];
      chaves[trocada[i]] = normal[i];
      res.push_back(make_pair(normal[i], trocada[i]));
    }
    if (chaves[normal[i]] != trocada[i] && chaves[trocada[i]] != normal[i]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << res.size() - cont << endl;
  for (int i = 0; i < res.size(); i++) {
    if (res[i].first != res[i].second) {
      cout << res[i].first << " " << res[i].second << endl;
    }
  }
  return 0;
}
