0

Input 2 string and remove first string from second one.

For example 1st input = ab 2nd input= abcdeb Output =cde

4th Sep 2022, 3:10 AM
Adarsh Chaturvedi
Adarsh Chaturvedi - avatar
4 ответов
+ 1
Use for loop of string1 and replace each matching character of string2 with empty character.
4th Sep 2022, 4:30 AM
A͢J
A͢J - avatar
+ 1
string1 = input() string2=input() for str in string1: string2 = string2.replace(str, "") print(string2)
4th Sep 2022, 8:53 AM
Mehdi Teimouri
Mehdi Teimouri - avatar
+ 1
Mehdi Teimouri use one more nested loop to check each character of 2nd string.
4th Sep 2022, 11:02 AM
Adarsh Chaturvedi
Adarsh Chaturvedi - avatar
0
Adarsh Chaturvedi there is no need for more loop because replace() method itself search the every character of it's first input and replace it with given character
5th Sep 2022, 3:06 AM
Mehdi Teimouri
Mehdi Teimouri - avatar