#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 2e3 + 4;
int main() {
  string s, t;
  cin >> s >> t;
  int n = (int)s.size();
  map<char, char> ma;
  set<char> st;
  for (int i = 0; i < 26; i++) st.insert((char)('a' + i));
  for (int i = 0; i < n; i++) {
    if (ma.find(s[i]) != ma.end()) {
      if (ma[s[i]] != t[i]) {
        printf("%d", -1);
        return 0;
      }
    } else {
      ma[s[i]] = t[i];
      if (ma.find(t[i]) != ma.end()) {
        if (ma[t[i]] != s[i]) {
          printf("%d", -1);
          return 0;
        }
      } else
        ma[t[i]] = s[i];
    }
  }
  vector<pair<char, char>> ans;
  for (auto it : ma)
    if (it.first != it.second and st.find(it.first) != st.end()) {
      ans.emplace_back(it.first, it.second);
      st.erase(it.first);
      st.erase(it.second);
    }
  printf("%d\n", (int)ans.size());
  for (auto it : ans) cout << it.first << " " << it.second << endl;
  return 0;
}
