Reverse of Individual Words in String

Write a program to reverse individual words in the given string.

C    PYTHON

#include<stdio.h>
int main() {
  char str[50],temp;
  int i,j,k=0;
  gets(str);
  for(i=0;str[i]!='\0';i++){
    if(str[i]== ' ' || str[i+1]=='\0'){
      if(str[i]==' ')
        j = i-1;
      if(str[i+1]=='\0')
        j = i;
      for(;k<=j;k++,j--){
        temp = str[k];
        str[k] = str[j];
        str[j] = temp;
      }
      if(str[i]==' ')
        str[i] = ' ';
      k=i+1;
    }
  }
  str[i] = '\0';
  puts(str);
}

Hello developers how are you
olleh srepoleved woh era uoy