Given a string and a pattern, Replace all the continuous occurrence of pattern with a single X in the string. For a clear view see the example below.
Input:
The first line of input contains an integer T denoting the number of test cases.
The first line of each test case is string str.
The second line of each test case contains a string s,which is a pattern.
Output:
Print the modified string str.
Constraints:
1 ≤ T ≤ 100
1 ≤ size of str,s ≤ 1000
Example:
Input
2
abababcdefababcdab
ab
geeksforgeeks
geeks
Output
XcdefXcdX
XforX
code:-
n = int(raw_input())
for i in range(n):
x=raw_input()
y=raw_input()
x1=x.replace(y,"X")
x2=""
count=0
for i in x1:
if i=='X':
if count==0:
x2+=i
count+=1
else:
count+=1
## do nothing
elif i!='X':
count=0
x2+=i
print (x2)