#include <iostream>
#include <algorithm>
using namespace std;
std::string Trimed(const std::string& s)
{
std::string::const_iterator begin = std::find_if(s.begin(),
s.end(),
[](char ch) { return !std::isspace(ch); });
std::string::const_iterator end = std::find_if(s.rbegin(),
s.rend(),
[](char ch) { return !std::isspace(ch); }).base();
return std::string(begin, end);
}
int main() {
string line;
while (getline(cin, line))
{
cout << Trimed(line) << "!" << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnN0ZDo6c3RyaW5nIFRyaW1lZChjb25zdCBzdGQ6OnN0cmluZyYgcykKewoJc3RkOjpzdHJpbmc6OmNvbnN0X2l0ZXJhdG9yIGJlZ2luID0gc3RkOjpmaW5kX2lmKHMuYmVnaW4oKSwKCQkJCQkJCQkJCQkJIHMuZW5kKCksCgkJCQkJCQkJCQkJCSBbXShjaGFyIGNoKSB7IHJldHVybiAhc3RkOjppc3NwYWNlKGNoKTsgfSk7CiAKCXN0ZDo6c3RyaW5nOjpjb25zdF9pdGVyYXRvciAgIGVuZCA9IHN0ZDo6ZmluZF9pZihzLnJiZWdpbigpLAoJCQkJCQkJCQkJCQkgcy5yZW5kKCksCgkJCQkJCQkJCQkJCSBbXShjaGFyIGNoKSB7IHJldHVybiAhc3RkOjppc3NwYWNlKGNoKTsgfSkuYmFzZSgpOwoJcmV0dXJuIHN0ZDo6c3RyaW5nKGJlZ2luLCBlbmQpOwp9CgppbnQgbWFpbigpIHsKCXN0cmluZyBsaW5lOwoKCXdoaWxlIChnZXRsaW5lKGNpbiwgbGluZSkpCgl7CgkJY291dCA8PCBUcmltZWQobGluZSkgPDwgIiEiIDw8IGVuZGw7Cgl9CglyZXR1cm4gMDsKfQo=