#include <bits/stdc++.h>
using namespace std;
char m[26];
vector<pair<char, char> > res;
string s, t;
bool verify() {
  for (int i = 0; i < s.size(); i++) {
    char x = s[i] - 'a';
    char y = t[i] - 'a';
    if ((m[x] != '-' && m[x] != t[i]) || (m[y] != '-' && m[y] != s[i]))
      return false;
    if (m[x] == '-') {
      m[x] = t[i];
      m[y] = s[i];
      if (s[i] != t[i]) res.push_back(make_pair(s[i], t[i]));
    }
  }
  return true;
}
void build() {
  for (int i = 0; i < 26; i++) {
    m[i] = '-';
  }
}
int main() {
  cin >> s >> t;
  build();
  if (verify()) {
    int size = res.size();
    printf("%d\n", size);
    for (int i = 0; i < size; i++) {
      cout << res[i].first << " " << res[i].second << endl;
    }
  } else
    printf("-1\n");
  return 0;
}
