/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 100 点
問題文
<, =, > のみからなる文字列 S が与えられます。
S が 双方向矢印型 の文字列であるか判定してください。
ただし、文字列 S が双方向矢印型の文字列であるとは、
ある正整数 k が存在して、
S が 1 個の < 、k 個の = 、1 個の > をこの順に連結した長さ (k+2) の文字列であることをいいます。
制約
- S は
<,=,>のみからなる長さ 3 以上 100 以下の文字列
入力
入力は以下の形式で標準入力から与えられる。
S
出力
S が 双方向矢印型 の文字列ならば Yes を、そうでないならば No を出力せよ。
入力例 1
<====>
出力例 1
Yes
<====> は、1 個の < 、4 個の = 、1 個の > をこの順に連結した文字列であり、双方向矢印型の文字列です。
よって、Yes を出力します。
入力例 2
==>
出力例 2
No
==> は双方向矢印型の文字列の条件をみたしていません。
よって、No を出力します。
入力例 3
<>>
出力例 3
No
Scoring: 100 points
Problem Statement
You are given a string S consisting of <, =, and >.
Determine whether S is a bidirectional arrow string.
A string S is a bidirectional arrow string if and only if there is a positive integer k such that S is a concatenation of one <, k =s, and one >, in this order, with a length of (k+2).
Constraints
- S is a string of length between 3 and 100, inclusive, consisting of
<,=, and>.
Input
The input is given from Standard Input in the following format:
S
Output
If S is a bidirectional arrow string, print Yes; otherwise, print No.
Sample Input 1
<====>
Sample Output 1
Yes
<====> is a concatenation of one <, four =s, and one >, in this order, so it is a bidirectional arrow string.
Hence, print Yes.
Sample Input 2
==>
Sample Output 2
No
==> does not meet the condition for a bidirectional arrow string.
Hence, print No.
Sample Input 3
<>>
Sample Output 3
No