#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int a[26], flag = 0, flag1 = 0, count = 0;
  for (int i = 0; i < 26; i++) {
    a[i] = -1;
  }
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) {
      flag1 = 1;
      if (a[s[i] - 'a'] == -1 && a[t[i] - 'a'] == -1) {
        a[s[i] - 'a'] = t[i] - 'a';
        a[t[i] - 'a'] = s[i] - 'a';
      } else if (a[s[i] - 'a'] != -1 && a[t[i] - 'a'] != -1) {
        if (a[s[i] - 'a'] == (int)(t[i] - 'a') &&
            a[t[i] - 'a'] == (int)(s[i] - 'a')) {
          continue;
        } else {
          flag = 1;
          break;
        }
      } else {
        flag = 1;
        break;
      }
    } else {
      if (a[s[i] - 'a'] == -1 || a[s[i] - 'a'] == -2)
        a[s[i] - 'a'] = -2;
      else {
        cout << "-1" << endl;
        return 0;
      }
    }
  }
  if (flag1 == 0) {
    cout << "0" << endl;
  } else if (flag == 0 && flag1 != 0) {
    int q = 0;
    for (int i = 0; i < 26; i++) {
      if (a[i] != -1 && a[i] != -2) {
        q++;
        a[a[i]] = -1;
      }
    }
    cout << q << endl;
    for (int i = 0; i < 26; i++) {
      if (a[i] != -1 && a[i] != -2) {
        cout << (char)(i + 'a') << " " << (char)(a[i] + 'a') << endl;
      }
    }
  } else {
    cout << "-1" << endl;
  }
}
