// Goal - convert words coming in to a format
//  suitable for word counts - strip leading and trailing
//  non-alpha characters and convert to lower case.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

int main(int argc, char *argv[]) {
  // read from stdin, write to stdout

  char s[100];
  while (scanf("%99s", s) == 1) {
    char *begin = s,      // first character
      *end = s + strlen(s); // terminating NULL character

    // remove leading non-alpha
    while (! isalpha(*begin) && begin < end) 
      begin++;

    // remove trailing non-alpha
    while (end > begin && !isalpha(*(end-1))) {
      end--; *end = '\0';
    }

    // convert to lower case
    for(int i=0; begin[i] != '\0'; i++)
      begin[i] = tolower(begin[i]);
    
    // print
    if (strlen(begin) > 0)
      printf("%s\n", begin);
    
  }
  
  return 0;
}