"I SPY YOU" WRONG submission

Ques. : CD202 Problem - CodeChef

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;

}

First, Your input is not valid, it is given in the question that after every vowel a ‘z’ and the same vowel is appended. Thus your input ‘ezezezeze’ doesn’t agree with the condition as it ends with a vowel without the proper ‘appends’.
Second, I think your approach to the problem is wrong. The correct algorithm should be:

  1. Read the characters from left to right.
  2. If the ith character is a vowel simply jump to (i+3) rd position.
  3. Repeat till you reach the end of the input.

And in the end just a simple advice always keep your array size a little longer than required to avoid any segmentation faults like if required is 100 then keep it of 110 etc.
I hope this helps!!