SSNK - Editorial

PROBLEM LINK:

Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4

Author: iceknight1093
Tester: sushil2006
Editorialist: iceknight1093

DIFFICULTY:

Cakewalk

PREREQUISITES:

None

PROBLEM:

A string is snaky if it either starts or ends with s.
Given a string A of length 4, check if it’s snaky.

EXPLANATION:

The string must either start or end with the letter s, which corresponds to either A_1 or A_4 being the character 's'.
Check these two conditions, and if either one is true, print Yes; otherwise print No.

(If you’re using 0-indexing, check for A_0 and A_3 instead.)

TIME COMPLEXITY:

\mathcal{O}(1) per testcase.

CODE:

Editorialist's code (Python3)
a = input()
if a[0] == 's' or a[3] == 's': print('Yes')
else: print('No')