#include<stdio.h>
int main()
{
int i,j,k,c;
char s[1000]; //array to store the input string
for(i=0;(c=getchar())!='.';++i) //string to be ended with '.'
{
s[i]=c;
for(j=0;j<=i;++j)
{
if((s[j]==s[j-1])&&(s[j]=='\n' || s[j]=='\t' ||s[j]==' '))
{
j=j-1;
}
}
for(k=0;k<=i;++k)
printf("%c", s[k]);
}
return 0;
}
I am trying to create a program that will remove a consecutive occurrence of white space character. But the output is not as intended. Pls tell me where i went wrong ???? A little support will be helpful !!