#include <bits/stdc++.h>
using namespace std;
long long n, m, l, cnt, cnt1, i;
bool ok, ok1 = false;
string s, s1;
pair<char, char> A[100];
int main() {
  cin >> s >> s1;
  n = s.size();
  for (int i = 0; i < n; i++) {
    ok = false;
    for (int j = 0; j < cnt1; j++) {
      if (s[i] == A[j].first) {
        if (s1[i] == A[j].second) {
          ok = true;
          break;
        } else
          return cout << "-1", 0;
      }
      if (s[i] == A[j].second) {
        if (s1[i] == A[j].first) {
          ok = true;
          break;
        } else
          return cout << "-1", 0;
      }
      if (s1[i] == A[j].first) {
        if (s[i] == A[j].second) {
          ok = true;
          break;
        } else
          return cout << "-1", 0;
      }
      if (s1[i] == A[j].second) {
        if (s[i] == A[j].first) {
          ok = true;
          break;
        } else
          return cout << "-1", 0;
      }
    }
    if (ok) continue;
    A[cnt1].first = s[i], A[cnt1].second = s1[i];
    cnt1++;
    if (s[i] != s1[i]) cnt++;
  }
  cout << cnt << endl;
  ok = false;
  for (int i = 0; i < cnt1; i++) {
    if (A[i].first != A[i].second)
      cout << A[i].first << " " << A[i].second << endl;
  }
  return 0;
}
