Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- strings = input().split(' ')
- search = input()
- palindromes = [x for x in strings if x[::-1] == x]
- repeating = {}
- for palindrome in palindromes:
- if not palindrome in repeating.keys():
- repeating[palindrome] = 0
- continue
- if repeating[palindrome] == 0:
- repeating[palindrome] += 1
- repeating[palindrome] += 1
- print(palindromes)
- times = max([0, *[v for k, v in repeating.items() if k == search]])
- print(f"Found palindrome {times} times")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement