Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <queue>
- using namespace std;
- int main() {
- string line;
- getline(cin, line);
- istringstream ss(line);
- queue<int> numbers;
- int number;
- while (ss >> number) {
- if (number % 2 == 0) {
- numbers.push(number);
- }
- }
- while (!numbers.empty()) {
- if (numbers.size() == 1) {
- cout << numbers.front() << endl;
- }
- else {
- cout << numbers.front() << ", ";
- }
- numbers.pop();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement