Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

"I SPY YOU" WRONG submission

$
0
0

Ques. : http://www.codechef.com/problems/CD202/

firstly,i want to know how this submission got ac?

http://www.codechef.com/viewsolution/608472

input : ezezezeze

output: ezez

correct output : ezeze

Correct me if i misinterpreted the question...

and why my code getting wrong answer?

include<bits stdc++.h="">

using namespace std;

int main()

{

char ch[101],s[101];
gets(ch);
int i,l,k=0,c[101]={0};
i=0;
l=strlen(ch);
while(i<l)
{
    if(ch[i]=='z' && i!=0 && i!=l-1)
    {
        if(c[i-1]==0 && ((ch[i-1]=='a' && ch[i+1]=='a') || (ch[i-1]=='e' && ch[i+1]=='e') || (ch[i-1]=='i' && ch[i+1]=='i') || (ch[i-1]=='o' && ch[i+1]=='o') || (ch[i-1]=='u' && ch[i+1]=='u')))
        {
            c[i+1]=1;
            i+=2;
            continue;
        }
    }
    s[k++]=ch[i++];
}
s[k]='\0';
puts(s);
return 0;

}


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>