Official

A - POSTal Code Editorial by tatyam


この問題では、文字列を標準入力から受け取り、\(4\) 文字目が - でそれ以外の文字が - でないことを確かめれば良いです。

回答例 (C++)

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    string S;
    cin >> S;
    cout << (count(S.begin(), S.end(), '-') == 1 && S[3] == '-' ? "Yes" : "No") << endl;
}

回答例 (Python)

S = input()
if S[3] == '-' and S.count('-') == 1:
    print("Yes")
else:
    print("No")

posted:
last update: