#include <bits/stdc++.h>
using namespace std;
long long n, i, x, z;
string s, s1;
map<char, char> mp;
pair<char, char> p[1001];
int main() {
  ios::sync_with_stdio(0);
  cin >> s >> s1;
  n = s.size();
  for (i = 0; i < n; i++) {
    if (s[i] != s1[i]) {
      if (mp[s[i]] == 0 && mp[s1[i]] == 0) {
        mp[s[i]] = s1[i];
        mp[s1[i]] = s[i];
        p[z].first = s[i];
        p[z].second = s1[i];
        z++;
      } else if (mp[s[i]] != s1[i]) {
        x = 1;
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (s[i] == s1[i] && mp[s[i]] != 0) {
      x = 1;
      break;
    }
  }
  if (x == 0) {
    cout << z;
    if (z != 0) {
      cout << endl;
      for (i = 0; i < z; i++) cout << p[i].first << ' ' << p[i].second << endl;
    }
  } else
    cout << -1;
  return 0;
}
