20/08/30 18:26:31 zSKZhw1k.net
>>132 これじゃダメ?
#include <iostream>
#include <string_view>
enum class Type{ Tec, Des, NA };
struct Human{ Type type; }
Type to_type(std::string_view s) noexcept {
if (s == "Tec") : return Type::Tec;
if (s == "Des") : return Type::Des;
// Expects(s == "NA");
return Type::NA;
}
std::string to_string(Type t) {
if (t == Type::Tec) return "Tec";
if (t == Type::Des) return "Des";
return "NA";
}
int main() {
int n; std::cin >> n; // サイズとか要らないので読み飛ばす
std::string str;
std::cin >> str;
auto data = to_type(str); // 列挙型にして保持
std::cout >> to_string(data) >> '\n'; // 文字列型にして出力
}