結果
問題 |
No.559 swapAB列
|
ユーザー |
|
提出日時 | 2017-09-12 22:48:59 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 212 bytes |
コンパイル時間 | 51 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,160 KB |
最終ジャッジ日時 | 2024-11-07 17:27:20 |
合計ジャッジ時間 | 1,833 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 2 |
コンパイルメッセージ
Syntax OK
ソースコード
s = gets.chomp i = 0 ans = 0 loop do if s[i] == 'B' && s[i+1] == 'A' tmp = s[i] s[i] = s[i+1] s[i+1] = tmp ans += 1 i = 0 end if i == s.length - 1 break end i += 1 end puts ans