#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main() {
string name;
while (true) {
bool ok = true;
cout << "Enter your name:\n";
getline(cin, name);
size_t nameSize = name.size();
if (nameSize == 0) continue;
for (size_t i = 0; i < nameSize; ++ i) {
if (
!(
isalpha(name[i]) ||
name[i] == ' ' // || ...
)
) {
ok = false; break;
}
}
if (ok) break;
}
cout << "Hello, " << name << "!" << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Y2N0eXBlPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewoKICAgIHN0cmluZyBuYW1lOwoKICAgIHdoaWxlICh0cnVlKSB7CgogICAgICAgIGJvb2wgb2sgPSB0cnVlOwoKICAgICAgICBjb3V0IDw8ICJFbnRlciB5b3VyIG5hbWU6XG4iOwoKICAgICAgICBnZXRsaW5lKGNpbiwgbmFtZSk7CgogICAgICAgIHNpemVfdCBuYW1lU2l6ZSA9IG5hbWUuc2l6ZSgpOwoKICAgICAgICBpZiAobmFtZVNpemUgPT0gMCkgY29udGludWU7CgogICAgICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgbmFtZVNpemU7ICsrIGkpIHsKICAgICAgICAgICAgaWYgKAogICAgICAgICAgICAgICAgISgKICAgICAgICAgICAgICAgICAgICBpc2FscGhhKG5hbWVbaV0pIHx8CiAgICAgICAgICAgICAgICAgICAgbmFtZVtpXSA9PSAnICcgLy8gfHwgLi4uCiAgICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICApIHsKICAgICAgICAgICAgICAgIG9rID0gZmFsc2U7IGJyZWFrOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBpZiAob2spIGJyZWFrOwogICAgfQoKICAgIGNvdXQgPDwgIkhlbGxvLCAiIDw8IG5hbWUgPDwgIiEiIDw8IGVuZGw7CgogICAgcmV0dXJuIDA7Cn0=