Official

B - Palindrome with leading zeros Editorial by en_translator Editorial for printing


Since \(N\) has at most \(10\) digits, we have to consider at most \(9\) zeros to prepend before \(N\). Thus, it is sufficient to check if it forms a palindrome after prepending \(0\) to \(9\) zeros respectively.

Sample Code (Python)

S=input()

for i in range(10):
	T = "0"*i + S
	if T==T[::-1]:
		print("Yes")
		exit()

print("No")

posted:
last update: