#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  map<char, char> m;
  bool ans = true;
  vector<pair<char, char>> v;
  int count = 0;
  for (int i = 0; i < s.size(); i++) {
    if (m.find(s[i]) != m.end()) {
      if (m[s[i]] != t[i]) {
        ans = false;
        break;
      } else {
        continue;
      }
    } else {
      if (m.find(t[i]) != m.end()) {
        ans = false;
        break;
      } else {
        m[s[i]] = t[i];
        m[t[i]] = s[i];
        if (s[i] != t[i]) {
          v.push_back({s[i], t[i]});
          count++;
        }
      }
    }
  }
  if (ans) {
    cout << count << endl;
    for (int i = 0; i < count; i++)
      cout << v[i].first << " " << v[i].second << endl;
  } else
    cout << "-1";
  return 0;
}
