Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <istream>
- #include <ostream>
- #include <stdexcept>
- using std::cin;
- using std::cout;
- using std::string;
- using std::endl;
- using std::vector;
- using std::istream;
- using std::ostream;
- using std::domain_error;
- vector <string> read_phrase(istream &in) {
- string word;
- vector <string> phrase;
- bool phrase_end = false;
- while (cin >> word && !phrase_end) {
- phrase.push_back(word);
- if (word[word.size() - 1] == '.')
- phrase_end = true;
- }
- if (phrase.size() == 0)
- throw domain_name("
- return phrase;
- }
- string format_phrase(const vector<string> &v) {
- string out;
- for (vector<string>::const_iterator i=v.begin() ; i!=v.end(); i++)
- out+=*i;
- return out;
- }
- vector <string> rotate_phrase(const vector <string> &v, int pos) {
- vector <string> out(v.begin()+pos, v.end());
- if (pos > v.size())
- throw domain_error("Invalid rotation number");
- for (vector <string>::const_iterator i = v.begin();
- i!=v.begin() + pos; i++)
- out.push_back(*i);
- return out;
- }
- int main()
- {
- vector <string> phrase;
- vector <vector <string> > phrase_perm;
- // phrase = read_phrase(cin);
- for (vector <string>::size_type i= 0;
- i!=phrase.size(); i++) {
- }
- try {
- phrase = read_phrase(cin);
- } catch
- phrase_perm = rotate_phrase
- cout << format_phrase(rotate_phrase(read_phrase(cin), 100));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement