SRM564 Div2 Easy(250) FauxPalindromes

FauxPalindromes

V.erase(unique(V.begin(),V.end()),V.end()) で連続している重複を削除できる。

#include <string>
#include <algorithm>
using namespace std;

class FauxPalindromes{public:
string classifyIt( string word )
{
    string r = word;
    reverse(r.begin(),r.end());
    if ( word==r )
        return "PALINDROME";

    word.erase(unique(word.begin(),word.end()),word.end());
    r = word;
    reverse(r.begin(),r.end());
    if ( word==r )
        return "FAUX";

    return "NOT EVEN FAUX";
}};