#include <bits/stdc++.h>
char s[1001], t[1001];
char encode[26], x[26], y[26];
int len, ans = 0;
int main() {
  gets(s);
  gets(t);
  len = strlen(s);
  for (int i = 0; i < 26; i++) encode[i] = '?';
  for (int i = 0; i < len; i++) {
    if (encode[s[i] - 'a'] == '?')
      encode[s[i] - 'a'] = t[i];
    else if (encode[s[i] - 'a'] != t[i]) {
      printf("-1\n");
      return 0;
    }
  }
  for (int i = 0; i < 26; i++)
    for (int j = i + 1; j < 26; j++)
      if (encode[i] == encode[j] && encode[i] != '?') {
        printf("-1\n");
        return 0;
      }
  for (int i = 0; i < 26; i++)
    if (encode[i] != '?' && encode[i] != i + 'a') {
      if (encode[encode[i] - 'a'] != '?' &&
          encode[encode[i] - 'a'] != i + 'a') {
        printf("-1\n");
        return 0;
      }
      encode[encode[i] - 'a'] = '?';
      x[ans] = i + 'a';
      y[ans] = encode[i];
      ans++;
    }
  printf("%d\n", ans);
  for (int i = 0; i < ans; i++) printf("%c %c\n", x[i], y[i]);
  return 0;
}
