Zoos

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 . 

2*x=y

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.


C Solution:


  1. #include<stdio.h>
  2. #include<string.h>
  3. int main(){
  4. char s[100];
  5. int c=0,c1=0;
  6. scanf("%s",s);
  7. for(int i=0;i<strlen(s);i++){
  8. if(s[i]=='z')
  9. c+=1;
  10. if(s[i]=='o')
  11. c1+=1;

  12. }
  13. if(c*2==c1)
  14. printf("Yes");
  15. else
  16. printf("No");
  17. return 0;
  18. }
Note:
       We Are Providing Every Content in this Blog Inspired From Many People and Provide it Open To All People Who Are Willing Gain Some Stuff in Computer Science.

Comment Below👇 If You Find Better Solution Than Above Solution.