#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int flag = 0;
  vector<char> arr(26, '.');
  for (int i = 0; i < s.length(); i++) {
    int a = int(s[i]);
    int b = int(t[i]);
    if (arr[a - 97] == t[i] || arr[a - 97] == '.') {
      arr[a - 97] = t[i];
      if (arr[b - 97] == s[i] || arr[b - 97] == '.')
        arr[b - 97] = char(a);
      else {
        cout << -1;
        flag = -1;
        break;
      }
    } else {
      cout << -1;
      flag = -1;
      break;
    }
  }
  if (flag != -1) {
    for (int i = 0; i < 26; i++) {
      if (arr[i] != '.') {
        int x = (int)arr[i];
        if (arr[x - 97] == char(i + 97) || arr[x - 97] == '.') {
          arr[x - 97] = '.';
          continue;
        } else {
          cout << -1;
          flag = -1;
          break;
        }
      }
    }
  }
  if (flag != -1) {
    int sum = 0;
    for (int i = 0; i < 26; i++) {
      if (arr[i] != '.') sum++;
    }
    cout << sum << endl;
    if (sum != 0) {
      for (int i = 0; i < 26; i++) {
        if (arr[i] != '.') cout << arr[i] << " " << char(i + 97) << endl;
      }
    }
  }
  return 0;
}
