Search Your Question...!

Problem - 1

 Problem Statement:

You are required to enter a word that consists of  and  that denote the number of Zs and Os respectively. The input word is considered similar to word zoo if .

Determine if the entered word is similar to word zoo.

For example, words such as zzoooo and zzzoooooo are similar to word zoo but not the words such as zzooo and zzzooooo.

Input format

First line: A word that starts with several Zs and continues by several Os.

Note: The maximum length of this word must be 20 .

Output format

Print Yes if the input word can be considered as the string zoo otherwise, print No.


# Write your code here

name=input()                             #Reading input from STDIN

if len(name) <=20:                    #Maximum length of word less than equal to 20

    zcount=name.count("z")            #count of z's in string

    ocount=name.count("o")            #count of o's in string

    if zcount*2 == ocount:            # checking o is twice of z in string

        print("Yes")

    else:

        print("No")   

else:

    print("No")                       #Writing output to STDOUT

OUTPUT:

Example1:

Example2:




No comments:

Post a Comment