Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <stdio.h>
- #include <vector>
- #include <sstream>
- using namespace std;
- int main()
- {
- int i, j;
- string s = "Ala ma kota i trzy psy. Ela ma tylko jednego!";
- string buffer;
- for(i = 0; i < s.size(); i++){
- if(s[i] >= 'A' && s[i] <= 'Z') s[i] += 32;
- else if(s[i] != ' ' && (s[i] > 'z' || s[i] < 'a')) s.erase(i, 1);
- }
- stringstream ss(s);
- cout << s;
- vector<string> G;
- while(ss >> buffer) G.push_back(buffer);
- sort(G.begin(), G.end());
- cout << endl;
- for(i = 0; i < G.size(); i++) cout << G[i] << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement