#include <bits/stdc++.h>
using namespace std;
int main() {
  string s1, s2;
  char ans1[1000], ans2[1000];
  int counter = 0;
  cin >> s1 >> s2;
  bool santaswrong = false;
  for (int i = 0; i < s1.size(); i++) {
    for (int j = 0; j < s1.size(); j++) {
      if (s1[j] == s1[i] && s2[i] != s2[j] ||
          s1[j] == s2[i] && s2[j] != s1[i] ||
          s2[i] == s2[j] && s1[i] != s1[j]) {
        cout << -1 << endl;
        santaswrong = true;
        break;
      }
    }
    if (santaswrong) break;
    bool unique = true;
    if (s1[i] == s2[i]) continue;
    for (int k = 0; k < counter; k++)
      if (s1[i] == ans1[k] || s1[i] == ans2[k]) {
        unique = false;
        break;
      }
    if (!unique) continue;
    ans1[counter] = s1[i];
    ans2[counter] = s2[i];
    ++counter;
  }
  if (!santaswrong) {
    cout << counter << endl;
    for (int i = 0; i < counter; i++) cout << ans1[i] << " " << ans2[i] << endl;
  }
  return 0;
}
