Problem:-
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 .
Output format
Print Yes if the input word can be considered as the string zoo otherwise, print No.Explanation-Time Limit:0.5 sec(s) for each input file.Memory Limit:256 MBSource Limit:1024 KB
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
Print Yes if the input word can be considered as the string zoo otherwise, print No.
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 .
Print Yes if the input word can be considered as the string zoo otherwise, print No.
Explanation
-
Time Limit:0.5 sec(s) for each input file.
Memory Limit:256 MB
Source Limit:1024 KB
Code:-
Solution by ( C language):-
#include<stdio.h>
#include<string.h>
int main()
{
char s[20];
int x,y=0,a=0,i,l;
gets(s);
l=strlen(s);
for(i=0;i<=l-1;i++)
{
x=s[i];
if(x==122)
y++;
else
a++;
}
if(2*y==a)
printf("Yes");
else
printf("No");
return 0;
}
Recommended Post:-
- Hackerearth Problems:-Data structure:-
- Very Cool numbers | Hacker earth solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Minimum addition | Hackerearth Practice problem
- The magical mountain | Hackerearth Practice problem
- The first overtake | Hackerearth Practice problem
- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- Minimum weight of spanning tree
- Preorder, inorder and post order traversal of the tree
0 Comments