79589826

Date: 2025-04-24 04:41:55
Score: 0.5
Natty:
Report link
#include <iostream>
#include <vector>
#include <sstream>

using namespace std;

int main() {
    string input = "1 2 3 4 5";  // Space-separated string of integers
    vector<int> nums;

    // Create a stringstream object with the input string
    stringstream ss(input);

    int temp;
    // Extract integers from the stringstream and add them to the vector
    while (ss >> temp) {
        nums.push_back(temp);
    }

    // Output the vector contents
    for (int num : nums) {
        cout << num << " ";
    }

    return 0;
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user30357599