Thursday, October 24, 2019

Hackerrank --Printing each word of an string in new line in c

#include <stdio.h>
int main()
{char sen[1000];
int i=0;

gets(sen);
while(sen[i]!='\0')
{  if(sen[i]==' ')
printf("\n");
else printf("%c",sen[i]);
i++;

}
return 0;
}

No comments:

Implement stsStr Leetcode solution

  28.   Implement strStr() Easy Implement  strStr() . Given two strings  needle  and  haystack , return the index of the first occurrence of...