#include<iostream>
#include<string>
#include<cctype>
#include<set>
#include<cstring>
#include<cstdio>

using namespace std;

string detectPalindrome(char *tex, int len, int c){
  int pre = c-1;
  int next = c+1;

  while(true){
    if( pre < 0 || next >= len ){
      ++pre;
      --next;
      break;
    }
    if( tex[pre] != tex[next] ){
      ++pre;
      --next;
      break;
    }
    --pre;
    ++next;
  }
  
  if(tex[pre]==tex[next])
    return string( tex+pre,tex+next+1 );
  return "";
}

int main()
{
  string t;
  while( getline(cin,t) ){
    char tex[2048] ={0,};
    int len = 0;
    set<string> S;

    tex[len]='$';
    ++len;
    for(int i = 0; i < (int)t.length(); ++i){
      if(isalpha(t[i])){
        tex[len] = toupper( t[i] );
        ++len;
        tex[len] = '$';
        ++len;
      }
    }

    // cout << tex << endl;

    for(int i = 0; i < len; ++i){
      string ret = detectPalindrome(tex,len,i);

      if(ret.length()>6){
        //cout <<"PALIN:"<<ret <<endl;

        bool ng = false;

        for(set<string>::iterator it = S.begin(); it != S.end();){
          int c1 = ret.length()/2;
          int c2 = it->length()/2;
          
          while(true){
            if(c1>=(int)ret.length()||c2>=(int)it->length()){
              --c1;
              --c2;
              break;
            }
            if(ret[c1]!=(*it)[c2]){
              break;
            }
            ++c1;
            ++c2;
          }

          //cout << c1 << ' ' << c2 << endl;

          if(ret[c1]==(*it)[c2]){
            //cout << "SAME?:"<< ret << ' ' << *it << endl;
            ng=true;
            if(ret.length()>it->length()){
              S.erase(it);
              S.insert(ret);
              it = S.begin();
            }else{
              break;
            }
          }

          ++it;
        }
        
        if(!ng){
          S.insert(ret);
        }
      }
    }

    for(set<string>::iterator it = S.begin(); it != S.end(); ++it){
      if(it!=S.begin())putchar(' ');
      for(int i = 0; i < (int)it->length(); ++i){
        if(isalpha( (*it)[i] )){
          putchar( (*it)[i] );
        }
      }
      
    }
    putchar('\n');
    
  }
  return 0;
}