#include <bits/stdc++.h>
using namespace std;
const int MAXINT = 1000;
string s1, s2;
char co[30];
int v[26], ans = 0;
int main() {
  cin >> s1 >> s2;
  for (int i = 0; i < s1.length(); i++) {
    if ((co[s1[i] - 'a'] != s2[i] && co[s1[i] - 'a'] != '\0') ||
        (co[s2[i] - 'a'] != s1[i] && co[s2[i] - 'a'] != '\0')) {
      printf("-1\n");
      return 0;
    } else {
      co[s1[i] - 'a'] = s2[i];
      co[s2[i] - 'a'] = s1[i];
    }
  }
  for (int i = 0; i < 26; i++) {
    if (co[i] != '\0' && co[i] != char('a' + i)) {
      ans++;
    }
  }
  printf("%d\n", ans / 2);
  for (int i = 0; i < 26; i++) {
    if (co[i] != '\0' && co[i] != char('a' + i)) {
      printf("%c %c\n", char(i + 'a'), co[i]);
      co[co[i] - 'a'] = '\0';
    }
  }
  return 0;
}
