荷物タグの最初の 3 文字は空港コードです。たとえば PEK-0815 なら PEK です。その 3 文字を返す airport_code(ticket) を書きましょう。タグは必ず 3 文字以上あります。
airport_code("PEK-0815")→'PEK'airport_code("LHR")→'LHR'string airport_code(const string &ticket)#include <string>
using namespace std;
string airport_code(const string &ticket) {
string code = "";
// ここにコードを書く:substr で最初の 3 文字を取り出す
return code;
}
実行すると例で試せます。よさそうなら提出しましょう。