#include <bits/stdc++.h>
using namespace std;
int flag[26], sign = 0;
map<int, int> mp;
struct Node {
  int x, y;
} ans[100010];
int main() {
  string str1, str2;
  cin >> str1 >> str2;
  int len = str1.size();
  for (int i = 0; i < len; i++) {
    int key1 = str1[i] - 'a', key2 = str2[i] - 'a';
    if (flag[key1] == 0 && flag[key2] == 0) {
      mp[key1] = key2;
      mp[key2] = key1;
      flag[key1] = flag[key2] = 1;
    }
    if ((flag[key1] == 1 && flag[key2] == 0) ||
        (flag[key1] == 0 && flag[key2] == 1)) {
      sign = 1;
      break;
    }
    if (flag[key1] == 1 && flag[key2] == 1) {
      if (mp[key1] != key2) {
        sign = 1;
        break;
      }
    }
  }
  if (sign) {
    cout << "-1\n";
  } else {
    int cnt = 0, vis[26];
    memset(vis, 0, sizeof vis);
    for (int i = 0; i < len; i++) {
      if (str1[i] != str2[i] && vis[str1[i] - 'a'] == 0 &&
          vis[str2[i] - 'a'] == 0) {
        ans[cnt].x = str1[i] - 'a';
        ans[cnt++].y = str2[i] - 'a';
        vis[str1[i] - 'a'] = vis[str2[i] - 'a'] = 1;
      }
    }
    cout << cnt << endl;
    for (int i = 0; i < cnt; i++) {
      char a = ans[i].x + 'a', b = ans[i].y + 'a';
      cout << a << ' ' << b << endl;
    }
  }
  return 0;
}
