#include #include #include using namespace std; void readEmAll(vector &x) { for (string work; cin>>work;) x.push_back(work); } void writeEmAll(const vector &x) { int i=0; //for (vector::const_iterator p=x.begin(); for (auto p=x.begin(); p!=x.end(); p++,i++) cout< &x) { string work; for (vector::const_iterator p=x.begin(); p!=x.end(); p++) work+=(*p); return work; // Will lead to more copying } void concatStrings(const vector &x,string &work) { for (vector::const_iterator p=x.begin(); p!=x.end(); p++) work+=(*p); } void append(vector &x,string suffix) { for (vector::iterator p=x.begin(); p!=x.end(); p++) (*p)+=suffix; } void append(vector &x,char suffix) { for (vector::iterator p=x.begin(); p!=x.end(); p++) (*p)+=suffix; } bool suffixCheck(const vector &x,const string &s) { for (vector::const_iterator p=x.begin(); p!=x.end(); p++) if ((*p).substr((*p).size()-s.size(),s.size())!=s) return false; return true; } int main() { vector allStrings; readEmAll(allStrings); writeEmAll(allStrings); //string concat=concatStrings(allStrings); string concat; concatStrings(allStrings,concat); cout<<"Everything concatenated:"<