BHPORSRP Editorial

PROBLEM LINK:

Practice
Contest

Author: Baban Gain
Tester: Baban Gain
Editorialist: Baban Gain

DIFFICULTY:

CAKEWALK

PREREQUISITES:

None

PROBLEM:

Given a string, find if it contains the word “Berhampore” or “Serampore” or “Both” or “None”

EXPLANATION:

First, convert the string to lower case as they are not case sensitive.
Then separate all the words of the string by space.
Then check if both exist, then print Both,
Otherwise, check if berhampore exist, then print GCETTB,
similarly, check if serampore exists and print GCETTS.
Otherwise, Print None.

SOLUTIONS:

Setter's Solution
T = int(input())
for z in range(T):
    s = input().lower().split()
    if "berhampore" in s and "serampore" in s:
        print("Both")
    elif "berhampore" in s:
        print("GCETTB")
    elif "serampore" in s:
        print("GCETTS")
    else:
        print("Others")

Link to Solution