I have seen questions like these:http://www.spoj.com/problems/ADFRUITS/,and I am using a method like this to handle it:while(1){ cin>>s; if(cin.eof()){ break; }}Since I am new to spoj and is continuously getting WA for this problem,just wanted to know if this is the right way or not?
while(cin >> s){... appears to be a more common pattern for this kind of input.
while(cin >> s){...