CF903E Swapping Characters
题目描述
给你 $k$ 个串,每个串长度都是 $n$,现在问你是否可能这些串是同一个串交换两个位置的字符所产生的,输出这个原串。
输入格式
第一行包含两个整数 $k$ 和 $n$ —我们获得的字符串数,以及每个字符串的长度。接下来的 $k$ 行包含字符串 $s_1$,$s_2$,$s_3$,... ,$s_k$ 每个字符串均由 $n$ 个小写拉丁字母组成。
输出格式
输出原串,如果不存在则输出"-1"。
说明/提示
In the first example $ s_{1} $ is obtained by swapping the second and the fourth character in acab, $ s_{2} $ is obtained by swapping the first and the second character, and to get $ s_{3} $ , we swap the third and the fourth character.
In the second example $ s_{1} $ is obtained by swapping the third and the fourth character in kbub, $ s_{2} $ — by swapping the second and the fourth, and $ s_{3} $ — by swapping the first and the third.
In the third example it's impossible to obtain given strings by aforementioned operations.