結果

問題 No.2924 <===Super Spaceship String===>
ユーザー forest3
提出日時 2025-02-14 16:53:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 450 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 162,088 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-14 16:53:29
合計ジャッジ時間 2,883 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for( int i = 0; i < n; i++ )
using ll = long long;

int main() {
	string s, t;
	cin >> s;
	int N = s.size();
	int f = 0;
	rep(i, N) {
		if(s[i] == '>') {
			if(f && t.back() == '=') {
				while(t.back() == '=') t.pop_back();
				t.pop_back();
				f--;
			}
			else {
				f = 0;
				t += s[i];
			}
		}
		else {
			if(s[i] == '<') f++;
			t += s[i];
		}
	}
	cout << t.size() << endl;
}
0