add: 220202-CN
This commit is contained in:
parent
8a7e8c00e8
commit
ca2536a1f7
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
class Solution {
|
||||||
|
public:
|
||||||
|
static std::string reversePrefix(std::string word, char ch) {
|
||||||
|
std::reverse(word.begin(), std::next(word.begin(), 1 + word.find(ch)));
|
||||||
|
return word;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::cout << Solution::reversePrefix("xyxzxe", 'z');
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -3,4 +3,4 @@ PROJECT(2202)
|
||||||
|
|
||||||
SET(CMAKE_CXX_STANDARD 23)
|
SET(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
ADD_EXECUTABLE(2202 220201.cpp)
|
ADD_EXECUTABLE(2202 220202-CN.cpp)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue