#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 1;
char a[N], b[N];
vector<int> g[26];
bool vis[26][26];
vector<pair<char, char> > sol;
char go[26];
int main() {
  scanf("%s%s", a, b);
  int n = strlen(a);
  for (int i = 0; i < n; ++i) {
    if (a[i] == b[i]) continue;
    int x = a[i] - 'a';
    int y = b[i] - 'a';
    g[x].push_back(y);
    g[y].push_back(x);
  }
  bool can = true;
  for (int i = 0; i < 26 && can; ++i) {
    sort(g[i].begin(), g[i].end());
    g[i].resize(unique(g[i].begin(), g[i].end()) - g[i].begin());
    can &= g[i].size() <= 1;
  }
  if (!can) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < 26; ++i)
    if (!g[i].empty()) {
      int x = min(i, g[i][0]), y = max(i, g[i][0]);
      if (vis[x][y]) continue;
      go[x] = y + 'a';
      go[y] = x + 'a';
      vis[x][y] = true;
      sol.push_back(make_pair(x + 'a', y + 'a'));
    } else
      go[i] = i + 'a';
  for (int i = 0; i < 26 && can; ++i) {
    can &= go[a[i] - 'a'] == b[i];
    can &= go[b[i] - 'a'] == a[i];
  }
  if (!can) {
    puts("-1");
    return 0;
  }
  printf("%d\n", (int)sol.size());
  for (int i = 0; i < (int)sol.size(); ++i)
    printf("%c %c\n", sol[i].first, sol[i].second);
  return 0;
}
