Here's part my code:
#include <stdio.h>
#include<string>
#include<string.h>
#include<algorithm>
#include <vector>
#include <iostream>
using namespace std;
int main(){
    FILE *in=fopen("C.in","r");
    //freopen("C.out","w",stdout);
    int maxl=0;
    int i;
    string word;
    vector<string> words;
    while(!feof(in)){
        fscanf(in,"%s ",word.c_str());
        int t=strlen(word.c_str());
        if(t>maxl){
            maxl=t;
            words.clear();
            words.insert(words.end(),word);
        }else if (t==maxl){
            words.insert(words.end(),word);
        }
    }
the problem occurs at
words.insert(words.end,word)
while
word
contains the word from my file, the vector item
words[i]
contains an empty string.
How is this possible?
 
    