rendered paste body#include <stdio.h>
#include <ctype.h>
void analyz(char *);
void reverse_part(char *, int, int);
main()
{
char *s="This isia a very super mega cooool string";
analyz(s);
}
void analyz(char *s)
{
int i,n,j=0;
int words[16][2];
for(i=0;i<strlen(s);i++){
if (isspace(s[i]))
continue;
else {
words[++j][0]=i;
while(isalpha(s[++i]));
words[j][1]=i-1;
if (j%2==0){
reverse_part(s, words[j][0], words[j][1]);
// printf("new sring is: %s\n", s);
}
}
}
}
void reverse_part(char *s, int start, int end)
{
//printf("%d %d\n", start, end);
int i,j;
char temp,temp1;
//printf("%c", temp);
if ((end-start)>1) {
for(i=start, j=end;j>i;i++,j--){
printf("jandi:%d %d\n s[i]=%c\n [j]=%c\n", j,i,s[i],s[j]);
temp=s[i];
s[i]=s[j];
s[j]=temp;
printf("success");
}
}
else {
temp=s[start];
s[start]=s[end];
s[end]=temp;
}
}