In this HackerEarth Harry and String problem solution Harry was studying a magic book that categorizes the magic spells into 3 categories - Good , Worst and Bad. If any spell contains all the vowels in alphabetical order then that spell is categorized as Good. If it contains the vowels in reverse alphabetical order , then that spell is categorized as Worst. All the other spells that do not fall in any of the categories before are categorized as Bad.

Now Harry tries to evaluate himslef by solving a spell categorization exercise at the end of the book , but since he is confused can you help him by solving the problems.

## HackerEarth Harry and String problem solution.

`#include <bits/stdc++.h>using namespace std;typedef long long int ll;typedef pair<ll, ll> pll;typedef vector<ll> vll;typedef vector<int> vi;#define pb push_backconst ll INF=1e18;const int mod=1000000007;char str;int main(){    ll t,n,m,i,j,k;    scanf ("%lld",&t);    while (t--)    {        scanf ("%s",str);        ll st,ed,f=0;        for (i=0;i<5;++i)        {            st[i]=-1;            ed[i]=-1;        }        for (i=0;str[i]!='\0';++i)        {            if (str[i]=='a')            {                if (st==-1)                    st=i;                ed=i;            }            else if (str[i]=='e')            {                if (st==-1)                    st=i;                ed=i;            }            else if (str[i]=='i')            {                if (st==-1)                    st=i;                ed=i;            }            else if (str[i]=='o')            {                if (st==-1)                    st=i;                ed=i;            }            else if (str[i]=='u')            {                if (st==-1)                    st=i;                ed=i;            }        }        k=ed;        for (i=1;i<5;++i)        {            if (st[i]!=-1)            {                if (k<st[i])                    k=ed[i];                else                    f=1;            }        }        if (f==1)        {            k=ed;            for (i=3;i>=0;--i)            {                if (st[i]!=-1)                {                    if (k<st[i])                        k=ed[i];                    else                        f=2;                }            }        }        if (f==0)            puts ("Good");        else if (f==1)            puts ("Worst");        else            puts ("Bad");    }  return 0;}`