結果

問題 No.559 swapAB列
ユーザー nebukuro09nebukuro09
提出日時 2017-08-25 22:25:06
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 256 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 7,072 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-23 15:31:23
合計ジャッジ時間 562 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,816 KB
testcase_01 AC 9 ms
6,944 KB
testcase_02 WA -
testcase_03 AC 9 ms
6,944 KB
testcase_04 AC 10 ms
6,944 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 10 ms
6,940 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = raw_input()
if S.count('A') == 0 or S.count('B') == 0:
    print 0
else:
    tmp = 0
    ans = 0
    for i in xrange(len(S)-1, -1, -1):
        if S[i] == 'A':
            tmp += 1
        else:
            ans += tmp
            tmp = 0
    print ans
0