Santa Claus and Keyboard Check

题意翻译

# 题义翻译 圣诞老人拆开、清洁了他的键盘,但是在将所有的按键安好后,他发现一些按键的位置发生 了两两交换!于是,圣诞老人猜测对于键盘上的每一个按键,要么在它本来正确的位置, 要么与另一个按键交换了位置。 为了验证他的猜想,他决定只根据正确的按键位置打出他 最爱的文字。现给出圣诞老人要打出的字符串 *s*,和他实际敲出的字符串 *t*,请你确定 哪几组字母发生了两两交换(即每对交换位置的字母不应出现在其他字母对中) # 输入格式 非空、等长,且长度最大为1000 的字符串 *s*、*t*,所有字母均为小写字母 # 输出格式 如果圣诞老人的猜想是错的,那么无法将位置交换的按键分为两两一组,此时输出“-1”(不含引号)\ 否则输出第一行只包含一个非负整数*k*(可以为0):交换位置的字母对数;下面的*k*行分别输出每对交换位置的字母,用空格隔开;所有字母至多出现一次。\ 如果存在多种答案,输出任意一种;输出字母对的顺序以及每个字母对中两个字母的顺序任意。

题目描述

Santa Claus decided to disassemble his keyboard to clean it. After he returned all the keys back, he suddenly realized that some pairs of keys took each other's place! That is, Santa suspects that each key is either on its place, or on the place of another key, which is located exactly where the first key should be. In order to make sure that he's right and restore the correct order of keys, Santa typed his favorite patter looking only to his keyboard. You are given the Santa's favorite patter and the string he actually typed. Determine which pairs of keys could be mixed. Each key must occur in pairs at most once.

输入输出格式

输入格式


The input consists of only two strings $ s $ and $ t $ denoting the favorite Santa's patter and the resulting string. $ s $ and $ t $ are not empty and have the same length, which is at most $ 1000 $ . Both strings consist only of lowercase English letters.

输出格式


If Santa is wrong, and there is no way to divide some of keys into pairs and swap keys in each pair so that the keyboard will be fixed, print «-1» (without quotes). Otherwise, the first line of output should contain the only integer $ k $ ( $ k>=0 $ ) — the number of pairs of keys that should be swapped. The following $ k $ lines should contain two space-separated letters each, denoting the keys which should be swapped. All printed letters must be distinct. If there are several possible answers, print any of them. You are free to choose the order of the pairs and the order of keys in a pair. Each letter must occur at most once. Santa considers the keyboard to be fixed if he can print his favorite patter without mistakes.

输入输出样例

输入样例 #1

helloworld
ehoolwlroz

输出样例 #1

3
h e
l o
d z

输入样例 #2

hastalavistababy
hastalavistababy

输出样例 #2

0

输入样例 #3

merrychristmas
christmasmerry

输出样例 #3

-1