diff --git a/2201/220122-CN.cpp b/2201/220122-CN.cpp new file mode 100644 index 0000000..d7400b6 --- /dev/null +++ b/2201/220122-CN.cpp @@ -0,0 +1,16 @@ +#include +#include + +class Solution { +public: + static int removePalindromeSub(const std::string& s) { + auto r = s; + std::reverse(r.begin(), r.end()); + return 1 + (!(s == r) && std::count_if(s.begin(), s.end(), [&](char c) { return c == (s[0] ^ 3); }) ? 1 : 0); + } +}; + +int main() { + std::cout << Solution::removePalindromeSub("abaaba"); + return 0; +} diff --git a/2201/CMakeLists.txt b/2201/CMakeLists.txt index c1873c4..69d315f 100644 --- a/2201/CMakeLists.txt +++ b/2201/CMakeLists.txt @@ -3,4 +3,4 @@ PROJECT(2201) SET(CMAKE_CXX_STANDARD 23) -ADD_EXECUTABLE(2201 220121.cpp) +ADD_EXECUTABLE(2201 220122-CN.cpp)