#include <bits/stdc++.h>
using namespace std;
int main() {
  set<pair<char, char> > st;
  string a, b;
  cin >> a >> b;
  for (int i = 0; i < a.length(); i++) {
    char p = a[i], q = b[i];
    if (p > q) swap(p, q);
    st.insert(make_pair(p, q));
  }
  int cnt = 0;
  vector<char> v[200];
  for (set<pair<char, char> >::iterator it = st.begin(); it != st.end(); it++) {
    char x = it->first;
    char y = it->second;
    v[x].push_back(y);
    v[y].push_back(x);
    if (x == y) cnt++, v[x].pop_back();
  }
  for (int i = 'a'; i <= 'z'; i++) {
    if (v[i].size() > 1) {
      puts("-1");
      return 0;
    }
  }
  cout << st.size() - cnt << endl;
  for (set<pair<char, char> >::iterator it = st.begin(); it != st.end(); it++) {
    if (it->first != it->second) cout << it->first << " " << it->second << endl;
  }
  return 0;
}
