1 #include <iostream> 2 #include <stdlib.h> 3 #include <string> 4 #include <sstream> 5 #include <vector> 6 using namespace std; 7 8 int main() 9 { 10 string s; 11 getline(cin, s); 12 for (auto it = s.begin(); it != s.end(); it++) 13 { 14 if (!isalpha(*it)) 15 (*it) = ' '; 16 } 17 18 istringstream ss(s); 19 string tmp; 20 vector<string>ans; 21 while (ss>>tmp) 22 { 23 tmp[0] = toupper(tmp[0]); 24 ans.push_back(tmp); 25 //tmp.clear(); 26 } 27 (ans.back()).insert((ans.back()).end(), '.'); 28 for (auto it = ans.begin(); it != ans.end(); it++) 29 { 30 if (it == prev(ans.end())) 31 cout << *it; 32 else 33 cout << *it << ' '; 34 } 35 system("pause"); 36 return 0; 37 }