Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- using namespace std;
- string manipulate(vector<string> arr)
- {
- string output;
- for (auto i: arr)
- if (count_if(i.begin(), i.end(), [](char a){return isupper(a);}) <= 1)
- output += i + '.';
- return output;
- }
- //Функция шоб выводить вектор. Возможн потом пригодится
- template <typename T>
- void printVector(vector<T> arr)
- {
- for (auto i: arr)
- cout << i << endl;
- }
- vector<string> mySplit(string str)
- {
- string bufStr = str;
- string delimiter = ".";
- vector<string> outputArr;
- size_t pos = 0;
- string token;
- while ((pos = bufStr.find(delimiter)) != string::npos)
- {
- token = bufStr.substr(0, pos);
- outputArr.push_back(token);
- bufStr.erase(0, pos + delimiter.length());
- }
- outputArr.push_back(bufStr);
- return outputArr;
- }
- int main()
- {
- string test = "Hello world. There is a lotus. Somewehere on the Earth.";
- vector<string> buf = mySplit(test);
- cout << manipulate(buf);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment