結果

問題 No.672 最長AB列
コンテスト
ユーザー vjudge1
提出日時 2026-01-12 17:52:05
言語 C++11(廃止可能性あり)
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 260 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,500 ms
コンパイル使用メモリ 179,776 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2026-01-12 17:52:08
合計ジャッジ時間 3,063 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 8 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
int ans, cnt;
int main(){
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i ++)
	{
		if (s[i] == 'A') ans ++;
		if (s[i] == 'B') cnt ++;
	}
	int minn = min(ans, cnt);
	cout << minn * 2 << endl;

	return 0;
}
//
0