I must take a few words and test to see if they are palindromes, not counting the characters of space, "," and "-".
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
int inputs;
for (int i=0;i<inputs;i++)
{string str;
getline(cin, str);
transform(str.begin(), str.end(), str.begin(), ::tolower);
str.erase(remove_if(str.begin(),str.end(),','),str.end());
str.erase(remove_if(str.begin(),str.end(),'-'),str.end());
str.erase(remove_if(str.begin(),str.end(),' '),str.end());
if (str == string(str.rbegin(), str.rend()))
cout << "Y ";
else
cout << "N "; }
}
the problems: In file included from /usr/include/c++/4.9/bits/stl_algobase.h:71:0, from /usr/include/c++/4.9/bits/char_traits.h:39, from /usr/include/c++/4.9/ios:40, from /usr/include/c++/4.9/ostream:38, from /usr/include/c++/4.9/iostream:39, from solution.cc:1:/usr/include/c++/4.9/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator >; _Predicate = char]':/usr/include/c++/4.9/bits/stl_algo.h:866:28: required from '_ForwardIterator std::__remove_if(_ForwardIterator, _ForwardIterator, _Predicate) [with _ForwardIterator = __gnu_cxx::__normal_iterator >; _Predicate = __gnu_cxx::__ops::_Iter_pred]'/usr/include/c++/4.9/bits/stl_algo.h:937:47: required from '_FIter std::remove_if(_FIter, _FIter, _Predicate) [with _FIter = __gnu_cxx::__normal_iterator >; _Predicate = char]'solution.cc:12:49: required from here/usr/include/c++/4.9/bits/predefined_ops.h:231:30: error: expression cannot be used as a function { return bool(_M_pred(*__it)); } ^
(complete jibberish to me.) Any solutions?