#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
string text;
cout << "Vvedite tekst: ";
getline(cin, text);
stringstream ss(text);
string word;
cout << "Slova dlinoy 5 simvolov:" << endl;
while(ss >> word) {
// Убираем знаки препинания (если есть)
string cleanWord = "";
for(char c : word) {
if(isalpha(c)) {
cleanWord += c;
}
}
if(cleanWord.length() == 5) {
cout << cleanWord << endl;
}
}
return 0;
}