302811: CF545B. Equidistant String

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Equidistant String

题意翻译

## 题目描述 Susie 喜欢字符串。她的字符串只包含数字 $0$ 和 $1$。今天,她使用了[汉明距离法](https://baike.baidu.com/item/%E6%B1%89%E6%98%8E%E8%B7%9D%E7%A6%BB/475174?fr=aladdin)计算了它们之间的距离。 汉明距离的定义表示两个相同长度字符串对应位置的不同字符的数量。 有2个长度为 $n$ 的字符串 $s$ 和 $t$ 她还想要一个长度为 $n$ 的字符串 $p$ 使得 $p$ 到 $s$ 的距离等于 $p$ 到 $t$ 的距离 请你帮她找到这样的字符串 $p$。可能有很多种答案,找到一种即可。 ## 输入格式 第一行是字符串 $s$ 第二行是字符串 $t$ ## 输出格式 输出一行字符串 $p$,如果不存在满足要求的字符串 $p$,输出 `impossible` ## 样例说明 第一组样例:汉明距离为3 答案也可以为 $1001$ 第二组样例:无法找到满足要求的字符串 translated by [Yang080108](https://www.luogu.com.cn/user/422348)

题目描述

Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of Hamming distance: We will define the distance between two strings $ s $ and $ t $ of the same length consisting of digits zero and one as the number of positions $ i $ , such that $ s_{i} $ isn't equal to $ t_{i} $ . As besides everything else Susie loves symmetry, she wants to find for two strings $ s $ and $ t $ of length $ n $ such string $ p $ of length $ n $ , that the distance from $ p $ to $ s $ was equal to the distance from $ p $ to $ t $ . It's time for Susie to go to bed, help her find such string $ p $ or state that it is impossible.

输入输出格式

输入格式


The first line contains string $ s $ of length $ n $ . The second line contains string $ t $ of length $ n $ . The length of string $ n $ is within range from $ 1 $ to $ 10^{5} $ . It is guaranteed that both strings contain only digits zero and one.

输出格式


Print a string of length $ n $ , consisting of digits zero and one, that meets the problem statement. If no such string exist, print on a single line "impossible" (without the quotes). If there are multiple possible answers, print any of them.

输入输出样例

输入样例 #1

0001
1011

输出样例 #1

0011

输入样例 #2

000
111

输出样例 #2

impossible

说明

In the first sample different answers are possible, namely — 0010, 0011, 0110, 0111, 1000, 1001, 1100, 1101.

Input

题意翻译

## 题目描述 Susie 喜欢字符串。她的字符串只包含数字 $0$ 和 $1$。今天,她使用了[汉明距离法](https://baike.baidu.com/item/%E6%B1%89%E6%98%8E%E8%B7%9D%E7%A6%BB/475174?fr=aladdin)计算了它们之间的距离。 汉明距离的定义表示两个相同长度字符串对应位置的不同字符的数量。 有2个长度为 $n$ 的字符串 $s$ 和 $t$ 她还想要一个长度为 $n$ 的字符串 $p$ 使得 $p$ 到 $s$ 的距离等于 $p$ 到 $t$ 的距离 请你帮她找到这样的字符串 $p$。可能有很多种答案,找到一种即可。 ## 输入格式 第一行是字符串 $s$ 第二行是字符串 $t$ ## 输出格式 输出一行字符串 $p$,如果不存在满足要求的字符串 $p$,输出 `impossible` ## 样例说明 第一组样例:汉明距离为3 答案也可以为 $1001$ 第二组样例:无法找到满足要求的字符串 translated by [Yang080108](https://www.luogu.com.cn/user/422348)

加入题单

算法标签: