#include <bits/stdc++.h>
using namespace std;
char x[27];
int main() {
  string a, b;
  cin >> a >> b;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] != b[i]) {
      if (!x[a[i] - 'a'] && !x[b[i] - 'a']) {
        x[a[i] - 'a'] = b[i];
        x[b[i] - 'a'] = a[i];
      } else if (x[a[i] - 'a'] != b[i]) {
        cout << "-1" << endl;
        return 0;
      }
    } else if (!x[a[i] - 'a']) {
      x[a[i] - 'a'] = a[i];
    } else if (x[a[i] - 'a'] != a[i]) {
      cout << "-1" << endl;
      return 0;
    }
  }
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    char p = 'a' + i;
    if (x[i] != p && x[i]) {
      ans++;
      x[x[i] - 'a'] = '\0';
    }
  }
  cout << ans << endl;
  for (int i = 0; i < 26; i++) {
    char p = 'a' + i;
    if (x[i] != p && x[i]) {
      cout << p << " " << x[i] << endl;
    }
  }
}
