結果

問題 No.559 swapAB列
ユーザー kentoserma
提出日時 2020-02-13 11:11:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 273 bytes
コンパイル時間 1,312 ms
コンパイル使用メモリ 166,124 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 09:26:30
合計ジャッジ時間 1,811 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {

  string S;
  int cnt;
  cin >> S;
  int n = S.length();

  cnt = 0;

  for(int i = 0; i < n - 1; i++){
    if(S[i] == 'B'){
      swap(S[i],S[i+1]);
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;

}
0