Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char strok[100];
- char strok1[100];
- char strokk[100];
- fgets(strok,100,stdin);
- strcpy(strok1, strok);
- char ans[30];
- char *io=strtok(strok1," ");
- strcpy(ans,io);
- while (io!= NULL && io[0]!="."){
- strcpy(ans,io);
- io=strtok(NULL," ");
- }
- strok[strlen(strok)-1]=' ';
- int len=0;
- char *chh=strtok(strok," ");
- char u;
- strcpy(strok1, chh);
- if (strcmp(strok1, ans ) != 0){
- strcpy(strokk, chh);
- u=strokk[0];
- if (strokk[strlen(strokk)-1]!='.'){
- strokk[0]=strokk[strlen(strokk)-1];
- strokk[strlen(strokk)-1]=u;
- strcat(strokk, " ");
- len+=strlen(strokk);
- }
- }
- while (chh!=NULL){
- chh=strtok(NULL, " ");
- if (chh!=NULL){
- strcpy(strok1, chh);
- if (strcmp(strok1, ans ) != 0){
- strcat(strokk, chh);
- if (strokk[strlen(strokk)-1]!='.')
- {
- u=strokk[len];
- strokk[len]=strokk[strlen(strokk)-1];
- strokk[strlen(strokk)-1]=u;
- strcat(strokk," ");
- }
- len=strlen(strokk);
- }
- if (strokk[len-1]=='.'){
- strokk[len-1]=' ';
- strokk[len-2]='.';
- }
- }
- }
- fputs(strokk,stdout);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement