#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
void trimRight (char * str) { *--find_if (make_reverse_iterator (str + strlen (str)), make_reverse_iterator (str), [] (char cur) {return cur != ' '; }) = '\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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y3N0cmluZz4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp2b2lkIHRyaW1SaWdodCAoY2hhciAqIHN0cikgeyAqLS1maW5kX2lmIChtYWtlX3JldmVyc2VfaXRlcmF0b3IgKHN0ciArIHN0cmxlbiAoc3RyKSksIG1ha2VfcmV2ZXJzZV9pdGVyYXRvciAoc3RyKSwgW10gKGNoYXIgY3VyKSB7cmV0dXJuIGN1ciAhPSAnICc7IH0pID0gJ1wwJzsgfQoKaW50IG1haW4gKGludCBhcmdjLCBjaGFyICphcmd2IFtdKQp7CgljaGFyIHMgWzgxOTNdOwoJc2NhbmYgKCIlODE5MlsgMDEyMzQ1Njc4OUFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpdIiwgcyk7CglwcmludGYgKCIlczpcbiVzLlxuIiwgIk9yaWdpbmFsIHN0cmluZyIsIHMpOwoJdHJpbVJpZ2h0IChzKTsKCXByaW50ZiAoIiVzOlxuJXMuXG4iLCAiVHJpbW1lZCBzdHJpbmciLCBzKTsKCXJldHVybiAwOwp9