#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  int s[26];
  bool used[26];
  bool tmp[26];
  for (int i = 0; i < 26; ++i) {
    s[i] = i;
    used[i] = false;
    tmp[i] = false;
  }
  int n = a.size();
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] == b[i]) {
      if (s[a[i] - 'a'] != a[i] - 'a') {
        cout << -1;
        return 0;
      }
      tmp[a[i] - 'a'] = true;
    } else {
      if ((s[a[i] - 'a'] == (b[i] - 'a') && s[b[i] - 'a'] == a[i] - 'a') ||
          (!tmp[a[i] - 'a'] && !tmp[b[i] - 'a'] &&
           s[a[i] - 'a'] == a[i] - 'a' && s[b[i] - 'a'] == b[i] - 'a')) {
        s[a[i] - 'a'] = b[i] - 'a';
        s[b[i] - 'a'] = a[i] - 'a';
        if (!tmp[a[i] - 'a']) {
          tmp[a[i] - 'a'] = true;
          tmp[b[i] - 'a'] = true;
          ans++;
        }
      } else {
        cout << -1;
        return 0;
      }
    }
  }
  cout << ans << "\n";
  for (int i = 0; i < 26; ++i) {
    if (s[i] != i && !used[i]) {
      used[i] = true;
      used[s[i]] = true;
      cout << (char)(i + 'a') << " " << (char)(s[i] + 'a') << endl;
    }
  }
  return 0;
}
