Monocarp has got two strings ss and tt having equal length. Both strings consist of lowercase Latin letters "a" and "b".
Monocarp wants to make these two strings ss and tt equal to each other. He can do the following operation any number of times: choose an index pos1pos1 in the string ss, choose an index pos2pos2 in the string tt, and swap spos1spos1 with tpos2tpos2.
You have to determine the minimum number of operations Monocarp has to perform to make ss and tt equal, and print any optimal sequence of operations — or say that it is impossible to make these strings equal.
Input
The first line contains one integer nn (1≤n≤2⋅105)(1≤n≤2⋅105) — the length of ss and tt.
The second line contains one string ss consisting of nn characters "a" and "b".
The third line contains one string tt consisting of nn characters "a" and "b".
Output
If it is impossible t
Swap Letters ------CodeForces - 1215C
最新推荐文章于 2020-11-22 13:23:51 发布
解决一个编程竞赛题目,题目要求通过交换两个字符串相同位置的字符来使它们变得相等。需要判断是否可能以及给出最小操作数和操作序列。
摘要由CSDN通过智能技术生成