#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s1, s2;
  cin >> s1 >> s2;
  int a[26], b[26] = {0};
  for (int i = 0; i < 26; i++) a[i] = i;
  int count = 0;
  for (int i = 0; i < s1.length(); i++) {
    if (s1[i] != s2[i]) {
      if (b[s1[i] - 97] == -1) {
        cout << -1 << endl;
        return 0;
      }
      if (b[s2[i] - 97] == -1) {
        cout << -1 << endl;
        return 0;
      }
      if (a[s1[i] - 97] != s2[i] - 97) {
        if (a[s1[i] - 97] != s1[i] - 97) {
          cout << -1 << endl;
          return 0;
        }
        if (a[s2[i] - 97] != s2[i] - 97) {
          cout << -1 << endl;
          return 0;
        }
        a[s1[i] - 97] = s2[i] - 97;
        a[s2[i] - 97] = s1[i] - 97;
        count++;
      }
    } else {
      if (a[s1[i] - 97] != s1[i] - 97) {
        cout << -1 << endl;
        return 0;
      }
      if (a[s2[i] - 97] != s2[i] - 97) {
        cout << -1 << endl;
        return 0;
      } else
        b[s1[i] - 97] = -1;
    }
  }
  cout << count << endl;
  for (int i = 0; i < 26; i++) {
    if (a[i] != i && a[i] != -1) {
      cout << (char)(i + 97) << " " << (char)(a[i] + 97) << endl;
      a[a[i]] = a[i];
      a[i] = i;
    }
  }
}
