結果

問題 No.559 swapAB列
コンテスト
ユーザー cologne
提出日時 2025-11-18 14:30:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,848 KB
実行使用メモリ 54,872 KB
最終ジャッジ日時 2025-11-18 14:30:33
合計ジャッジ時間 1,535 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import Counter
import sys


def input(): return sys.stdin.readline().rstrip('\n')


def main():
    ans = 0
    k = 0
    for c in input():
        if c == 'A':
            ans += k
        else:
            k += 1
    print(ans)


if __name__ == '__main__':
    main()
0