Two strings of lengths n and n+1 are provided . The first string’s whole,plus one more character is present in the second string. Finding the extra character in the second string is your responsibility.
Two strings of lengths n and n+1 are
provided . The first string’s whole,plus one more character is present in the
second string. Finding the extra character in the second string is your responsibility.
You have to find the one extra character
in the string
Example:
Kxml klxml
Output:
l
Example 2:
abcd cbdad
Output:
d
Code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
word1, word2 = input().split() | |
res1 = ''.join(sorted(word1)) | |
res2 = ''.join(sorted(word2)) | |
res1 = list(res1) | |
res2 = list(res2) | |
for x in res1: | |
if x in res2: | |
res2.remove(x) | |
print(''.join(res2)) |
0 Comments
Post a Comment