Longest Word in Strings

Write a program to find longest word in the given string.

C    PYTHON

#include<stdio.h>
int main() {
  char str[100];
  int i,j,c1=0,c2=0;
  gets(str);
  for(i=0;str[i]!='\0';i++){
    if(str[i]==' ' || str[i+1]=='\0'){
      if(c2<c1){
        c2=c1;
        j=i-c1;
      }
      c1=0;
    } else{
      c1++;
    }
  }
  for(i=j;i<j+c2;i++)
    printf("%c",str[i]);
  return 0;
}

Hello developers how are you
developers