#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(false);
  string a, b;
  while (cin >> a >> b) {
    unsigned int len = a.size();
    int ans = 0;
    bool OK = true;
    map<int, int> dic;
    for (unsigned int i = 0; i < len; ++i) {
      if (a.at(i) != b.at(i)) {
        if (!dic.count(a.at(i)) && !dic.count(b.at(i))) {
          ++ans;
          dic[a.at(i)] = b.at(i);
          dic[b.at(i)] = a.at(i);
        } else if (dic[a.at(i)] != b.at(i) || dic[b.at(i)] != a.at(i)) {
          cout << -1 << endl;
          OK = false;
          break;
        }
      } else {
        if (!dic.count(a.at(i))) {
          dic[a.at(i)] = a.at(i);
        } else if (dic[a.at(i)] != a.at(i)) {
          cout << -1 << endl;
          OK = false;
          break;
        }
      }
    }
    if (OK) {
      cout << ans << endl;
      int vis[1000] = {0};
      if (ans != 0) {
        for (char c = 'a'; c <= 'z'; ++c) {
          if (!vis[(int)c] && dic[c] != 0 && dic[c] != c) {
            cout << c << " " << (char)dic[c] << endl;
            vis[dic[c]] = c;
          }
        }
      }
    }
  }
  return 0;
}
