#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  string b;
  cin >> a;
  cin >> b;
  int s = a.size();
  vector<int> ot1;
  vector<int> ot2;
  vector<int> v(26, -1);
  int count = 0;
  int u = 0;
  for (int i = 0; i < s; i++) {
    if (a[i] == b[i]) {
      if (v[a[i] - 'a'] == -1 && v[a[i] - 'a'] == -1)
        v[a[i] - 'a'] = a[i] - 'a';
      else if (v[a[i] - 'a'] != a[i] - 'a') {
        cout << -1;
        return 0;
      }
    } else if (a[i] != b[i]) {
      if (v[a[i] - 'a'] == -1 && v[b[i] - 'a'] == -1) {
        v[a[i] - 'a'] = b[i] - 'a';
        v[b[i] - 'a'] = a[i] - 'a';
        count += 1;
        ot1.push_back(a[i] - 'a');
        ot2.push_back(b[i] - 'a');
      } else if (v[a[i] - 'a'] == b[i] - 'a' && v[b[i] - 'a'] == a[i] - 'a')
        u += 1;
      else {
        cout << -1;
        return 0;
      }
    }
  }
  int rew = ot1.size();
  cout << rew << endl;
  if (rew > 0) {
    for (int i = 0; i < rew; i++) {
      char e1 = 'a' + ot1[i];
      char e2 = 'a' + ot2[i];
      cout << e1 << " " << e2 << endl;
    }
  }
  return 0;
}
