#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main() {
string str;
getline(cin,str);
stringstream ss(str);
vector<int> arr;
while(!ss.eof()){
int num;
char ch;
ss>>num>>ch;
arr.push_back(num);
}
for(int i=0;i<arr.size();i++){
cout<<arr.at(i)<<endl;
}
return 0;
}
I am getting output for 1,2,3,4,5 as 1 2 3 4 5 but for 1 2 3 4 5 it is 1 3 5 why? space is also a character so it should work or am I missing something? thank you for helping.