Perfect String

Description:

Harish develops a dictionary game that accepts only perfect string. A string is perfect if the string contains the (string length / 2) numbers of vowels . The game displays "Perfect" in case of perfect string or displays "Wrong Input" Test Case 1 Input (stdin) abedix Expected Output Perfect Test Case 2 Input (stdin) abcdef Expected Output Wrong Input

Program :

#include <iostream>

#include<string.h>

using namespace std;

int main()

{

char s[30];

  int i,v=0,c=0;

  cin>>s;

  for(i=0;i<strlen(s);i++)

  {

    if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u')

      v++;

    else

      c++;

  }

  if(v==c)

    cout<<"Perfect";

  else

    cout<<"Wrong Input";

return 0;

}