Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int len;
- char ara[1000];
- while(gets(ara)) {
- int j,x,k;
- len=strlen(ara);
- int i =0;
- x = i -1;
- /* ekhane amra ekta loop chaliye check korbo space ache naki..
- jekhane space pabo, tar ek ghor aage theke last jekhane space paichilam, tar ek ghor por
- porjonto print korbo */
- for(i=0;i<len;i++) {
- if(ara[i]==' ') {
- for(j=i-1;j>x;j--) {
- printf("%c",ara[j]);
- }
- printf(" ");
- x=i;
- }
- }
- /* eta last word tar jonno.. karon aage loop tar moddhe
- amra jei space khujchi, oita last word ar er aager moddhei ache..
- nicher ta na likhle tai last word print hobe na.. */
- for(i=len-1;i>x;i--){
- printf("%c",ara[i]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement