#include <iostream>
#include <string>
#include <set>
using namespace std;

bool is_palindrome(string s){
/*     string r = s;
     reverse(r.begin(), r.end());
     return s == r;
*/     
     return equal(s.begin(), s.end(), s.rbegin());
     //     s.rend()         s.rbegin()
     //     V                V
     //  s : [ |  |   |   |  ]
     //       ^                ^
     //       s.begin()         s.end()  [one-pass-the-end]
}     

void process(string line){
     set<string> dict;
     for (int i = 0; i < line.length(); ++i)
       for (int j = 1; i + j <= line.length(); ++j){
           string s = line.substr(i, j);
           if (is_palindrome(s))
             dict.insert(s);
       }
    /*   for (set<string>::iterator p = dict.begin();
            p != dict.end();
            ++p)
            cout << *p << ' ';
       cout << endl;     */
       cout << "The string '" << line << "' contains "
            << dict.size() << " palindromes." << endl;
}
                        
int main(){
    string line;
    while (getline(cin, line))
      process(line);
}
