#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
char s[maxn];
char t[maxn];
int vis[maxn];
struct Node {
  char a, b;
  Node(char _a, char _b) {
    if (_a > _b) swap(_a, _b);
    a = _a;
    b = _b;
  }
  Node() {}
};
vector<Node> ans;
int main() {
  scanf("%s%s", s, t);
  memset(vis, 0, sizeof vis);
  int n = strlen(s);
  bool flag = true;
  for (int i = 0; i < n; ++i) {
    char c = s[i];
    char c2 = t[i];
    if (vis[c] == c2 && vis[c2] == c) continue;
    if (vis[c] || vis[c2]) {
      flag = false;
      break;
    }
    vis[c] = c2;
    vis[c2] = c;
    if (c != c2) ans.push_back(Node(c, c2));
  }
  if (flag) {
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); ++i) printf("%c %c\n", ans[i].a, ans[i].b);
  } else
    printf("-1\n");
  return 0;
}
