#include <bits/stdc++.h>
using namespace std;
string s, r;
int ans, n;
int main() {
  ios::sync_with_stdio(0);
  vector<int> v(26, -1);
  vector<int> visited(26, 0);
  vector<pair<char, char>> exchange;
  cin >> s >> r;
  if (s.length() != r.length()) return cout << -1, 0;
  n = s.length();
  n--;
  for (int i = 0; i <= n; i++) {
    if (v[s[i] - 'a'] == -1 && v[r[i] - 'a'] == -1) {
      v[s[i] - 'a'] = r[i] - 'a';
      v[r[i] - 'a'] = s[i] - 'a';
    } else if (v[s[i] - 'a'] != r[i] - 'a' || v[r[i] - 'a'] != s[i] - 'a')
      return cout << -1, 0;
  }
  for (int i = 0; i <= 25; i++) {
    if (v[i] != v[v[i]] && !visited[i] && !visited[v[i]]) {
      ans++;
      exchange.push_back(make_pair(char('a' + i), char('a' + v[i])));
      visited[i] = visited[v[i]] = 1;
    }
  }
  cout << ans << endl;
  n = exchange.size();
  n--;
  for (int i = 0; i <= n; i++) {
    cout << exchange[i].first << " " << exchange[i].second << "\n";
  }
  return 0;
}
