char = {"12", "21", "34", "43", "56", "65", "78", "87", "09", "90"}
n = 12
s = '431226543561'
for ele in char:
for i in range(n):
if ele == s[i:i+2]:
s = s.replace(ele,"")
print("len",len(s))
o/p: 1st: len 0
2nd: len 2
most of time 0 some times 2 as output