#include <bits/stdc++.h>
using namespace std;
char arr[300];
int main() {
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  int n = s.size();
  memset(arr, 'A', sizeof(arr));
  if (n != t.size()) {
    cout << -1;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (arr[t[i]] != 'A') {
      if (arr[t[i]] != s[i]) {
        cout << -1;
        return 0;
      }
      continue;
    }
    if (arr[s[i]] == 'A') {
      arr[s[i]] = t[i];
      arr[t[i]] = s[i];
    }
    if (arr[s[i]] != t[i]) {
      cout << -1;
      return 0;
    }
  }
  vector<pair<char, char> > v;
  for (int i = 0; i < 300; i++) {
    if (arr[i] != 'A') {
      if (i == arr[i]) continue;
      v.push_back(make_pair((char)i, arr[i]));
      arr[arr[i]] = 'A';
      arr[i] = 'A';
    }
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++)
    cout << v[i].first << " " << v[i].second << endl;
  return 0;
}
