PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: iceknight1093
Tester: raysh07
Editorialist: iceknight1093
DIFFICULTY:
Simple
PREREQUISITES:
None
PROBLEM:
Given a string S of length 4, check if it’s an echo.
S is an echo if and only if S_1 = S_3 and also S_2 = S_4.
EXPLANATION:
As the statement says, check if S_1 = S_3 and S_2 = S_4.
If you are using 0-indexing, the checks are instead S_0 = S_2 and S_1 = S_3.
If both conditions are true, print Yes; otherwise print No.
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (PyPy3)
s = int(input())
print('Yes' if s[0] == s[2] and s[1] == s[3] else 'No')