#include <bits/stdc++.h>
using namespace std;
string a, b;
int cnt, ans[130];
unordered_map<char, char> temp;
int main() {
  cin >> a >> b;
  for (int i = 0; i < a.size(); ++i) {
    if ((temp.count(a[i]) && temp[a[i]] != b[i]) ||
        (temp.count(b[i]) && temp[b[i]] != a[i])) {
      puts("-1");
      return 0;
    }
    if (a[i] != b[i] && !temp.count(a[i])) {
      ++cnt;
      ans[cnt] = a[i];
    }
    temp[a[i]] = b[i];
    temp[b[i]] = a[i];
  }
  printf("%d\n", cnt);
  for (int i = 1; i <= cnt; ++i) {
    printf("%c %c\n", ans[i], temp[ans[i]]);
  }
  return 0;
}
