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