| Код | #include <string> #include <algorithm> #include <functional> #include <iostream>
// Предикат для определения (не)чётности кода символа template <typename T> struct odd : public std::unary_function<typename T::value_type, bool> { result_type operator()(const argument_type ch) const { return ch & 1; } };
// Перестановка символов в строке template <typename T> T transform(const T& src) { T result = src; std::partition(result.begin(), result.end(), odd<T>()); return (result); }
int main() { std::string source; std::getline(std::cin, source);
std::string modified = transform(source); std::cout << modified << std::endl;
return (0); } |
|