Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char str[1000],ab[1000];
- printf("Enter a string: ");
- scanf("%[^\n]%*c",str);
- int i,p,q=0;
- for(i=0; str[i]!='\0' ; i++)
- {
- if(str[i]=='f')
- {
- p=i;
- if(str[p+1]=='o' && str[p+2]=='r' && str[p+3]==' ' )
- {
- ab[q]=str[i];
- q++;
- ab[q]=str[p+1];
- q++;
- ab[q]=str[p+2];
- q++;
- ab[q]=' ';
- q++;
- }
- }
- else if(str[i]=='w')
- {
- p=i;
- if(str[p+1]=='h' && str[p+2]=='i' && str[p+3]=='l' && str[p+4]=='e' && str[p+5]==' ')
- {
- ab[q]=str[i];
- q++;
- ab[q]=str[p+1];
- q++;
- ab[q]=str[p+2];
- q++;
- ab[q]=str[p+3];
- q++;
- ab[q]=str[p+4];
- q++;
- ab[q]=' ';
- q++;
- }
- }
- }
- ab[q]='\0';
- printf("\nKeywords are: ");
- for(i=0; ab[i]!='\0'; i++)
- {
- printf("%c",ab[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement