All pastes #508584 Raw Edit

Mine

public cpp v1 · immutable
·published 2007-05-25 02:15 UTC
rendered paste body
/*ID: jack5251PROG: calfflacLANG: C++*/#include <fstream>#include <string>#include <algorithm>#include <cstring>//#include <functional>#include <iostream>#include <cstdlib>using namespace std;template<typename Arg>class notalpha {public:    bool operator ()(const Arg &t) const {	if(isalpha(t))	    return false;	else	    return true;    }};bool paltest(string str) {    remove_if(str.begin(), str.end(), notalpha<char>());    string cp = str;    reverse(str.begin(), str.end());    if (str == cp)	return true;    else	return false;}int main() {    ifstream fin("calfflac.in");    ofstream fout("calfflac.out");    string start = "";    while(!fin.eof()) {	string str;	getline(fin, str);	start += str;    }    cout << start << endl;    string cp = start;//    int mid = start.length()/2;//    transform(start.begin(), start.end(), tolower);    string longest = "";    for (int x=0; x < start.length(); x++) {	for (int y=start.length()-1; y > x + longest.length(); y--) {	    if (start.at(x) == start.at(y))		if (paltest(start.substr(x, y-x))) {		    longest = start.substr(x, y-x);		    y=0;		}	}    }    fout << longest.length() << endl	 << longest << endl;    return 0;}