Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <iterator>
- #include <sstream>
- #include <cmath>
- #include <list>
- std::string getLower(std::string str) {
- std::string newString = "";
- for (int i = 0; i < str.length(); ++i) {
- char current = std::tolower(str.at(i));
- newString += current;
- }
- return newString;
- };
- int main() {
- std::string input;
- std::getline(std::cin, input);
- std::stringstream stringstream(input);
- std::string str = "";
- std::vector<std::string> vector;
- while (stringstream >> str) {
- vector.push_back(str);
- }
- std::vector<std::string> result;
- for (int i = 0; i < vector.size(); ++i) {
- std::string current = getLower(vector[i]);
- vector.erase(vector.begin() + i);
- i--;
- int countRepeated = 1;
- for (int j = i + 1; j < vector.size(); ++j) {
- std::string currentString = getLower(vector[j]);
- if (current == currentString) {
- vector.erase(vector.begin() + j);
- j--;
- countRepeated++;
- }
- }
- if (countRepeated % 2 != 0) {
- result.push_back(current);
- }
- }
- for (int k = 0; k < result.size(); ++k) {
- if (k == result.size() - 1) {
- std::cout << result[k];
- } else {
- std::cout << result[k] << ", ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement