#include <iostream>
#include <cstdio>
using namespace std;
void TrimRight(char * s)
{
size_t space_counter = 0;
for(;;)
{
if (!*s) break;
if (*s == ' ')
space_counter++;
else
space_counter = 0;
++s;
}
*(s - space_counter) = '\0';
}
int main(int argc, char *argv[])
{
char s[8193];
scanf("%8192[ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]", s);
printf("%s:\n%s\n", "Original string", s);
TrimRight(s);
printf("%s:\n%s\n", "Trimmed string", s);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnZvaWQgVHJpbVJpZ2h0KGNoYXIgKiBzKQp7CiAgICBzaXplX3Qgc3BhY2VfY291bnRlciA9IDA7CgogICAgZm9yKDs7KQoJewoJICAgIGlmICghKnMpIGJyZWFrOwoKCSAgICBpZiAoKnMgPT0gJyAnKQoJCQlzcGFjZV9jb3VudGVyKys7CgkgICAgZWxzZQoJCQlzcGFjZV9jb3VudGVyID0gMDsKCgkgICAgKytzOwoJfQoKICAgICoocyAtIHNwYWNlX2NvdW50ZXIpID0gJ1wwJzsKfQoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKmFyZ3ZbXSkKewogICAgY2hhciBzWzgxOTNdOwogICAgc2NhbmYoIiU4MTkyWyAwMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5el0iLCBzKTsKICAgIHByaW50ZigiJXM6XG4lc1xuIiwgIk9yaWdpbmFsIHN0cmluZyIsIHMpOwogICAgVHJpbVJpZ2h0KHMpOwogICAgcHJpbnRmKCIlczpcbiVzXG4iLCAiVHJpbW1lZCBzdHJpbmciLCBzKTsKICAgIHJldHVybiAwOwp9
ZnNrbGRmZHMgZmRzIGZmZmZmZmZzYWxrZHNhamZsayBsa20gbGZhc2ttYWxtIGxtayAgICAgICAgICAgIGFzbGtkbWtsc20gZGttIGxha21zIGxrbSBsbWxhc2ttIGxrbSBsIGxha21kbCBrZm5ramZuIEtOIGtqIG5FSmZrZCBuRGZuIGtqIG5raiBuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIA==
fskldfds fds fffffffsalkdsajflk lkm lfaskmalm lmk aslkdmklsm dkm lakms lkm lmlaskm lkm l lakmdl kfnkjfn KN kj nEJfkd nDfn kj nkj n