問題一覧 > 通常問題

No.2924 <===Super Spaceship String===>

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 156
作問者 : tnodino / テスター : mymelochan 👑 loop0919 hirayuu_yc kusirakusira nouka28 uruzunyaa
お気に入りにしたユーザー ProblemId : 11065 / 自分の提出
問題文最終更新日: 2024-10-12 14:42:07
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
第3回緑以下コンテスト (順位表) の他の問題:

Problem Statement

There is a string $S$, and $S$ consists only of <, >, and =.

A string satisfying the following condition is called a super spaceship string.

  • It is the concatenation of 1 character <, 1 or more characters =, and 1 character >, in this order.

For example, <=> and <====> are super spaceship strings, but >=<, <>, and <==<> are not.

You may perform the following operation any number of times: choose a substring of the string $S$ that is a super spaceship string, remove it, and concatenate the parts before and after it.

When the operations are performed appropriately, what is the minimum possible length of $S$?

Constraints

  • $1 \le |S| \le 5 \times 10^5$
  • The string $S$ consists only of <, >, and =.

Input

$S$

Output

Output the answer.

Sample

Sample 1
Input
<=<<==>=><>
Output
4

For example, a length of 4 can be achieved by performing the operations as follows.

  • Remove the 4 ~ 7th characters of <=<<==>=><>, which gives <=<=><>.
  • Remove the 3 ~ 5th characters of <=<=><>, which gives <=<>.
  • No operation can be performed on <=<>.

No matter how the operations are performed, the string cannot become any shorter, so the answer is 4.

Sample 2
Input
>=<=<>=>=<
Output
10

There are also cases where no operation can be performed even once.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。