#include <bits/stdc++.h>
using namespace std;
int chk[26];
vector<pair<int, int> > ans;
int main() {
  string s1, s2;
  int len, k = 0, flag = 0;
  cin >> s1 >> s2;
  len = s1.length();
  for (int i = 0; i < len; i++) {
    if (s1[i] == s2[i]) {
      if (chk[s1[i] - 'a'] > 0) {
        flag = 1;
        break;
      }
      chk[s1[i] - 'a'] = -1;
    } else {
      if (chk[s1[i] - 'a'] == chk[s2[i] - 'a']) {
        if (chk[s1[i] - 'a'] == -1 || chk[s2[i] - 'a'] == -1) {
          flag = 1;
          break;
        }
        if (chk[s1[i] - 'a'] != 0) continue;
        chk[s1[i] - 'a'] = chk[s2[i] - 'a'] = ++k;
        ans.push_back(make_pair(s1[i], s2[i]));
      } else {
        flag = 1;
        break;
      }
    }
  }
  printf("%d\n", flag ? -1 : ans.size());
  for (int i = 0; i < ans.size() && !flag; i++)
    printf("%c %c\n", ans[i].first, ans[i].second);
  return 0;
}
