結果

問題 No.2021 Not A but B
ユーザー ID 21712
提出日時 2024-11-18 22:28:06
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 277 bytes
コンパイル時間 15,708 ms
コンパイル使用メモリ 238,396 KB
実行使用メモリ 7,648 KB
最終ジャッジ日時 2024-11-18 22:28:26
合計ジャッジ時間 15,881 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other AC * 12 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import . "fmt"
import . "strings"

func main() {
	var n,s string
	Scan(&n,&s)
	var c int
	if Contains(s,"BB") {
		c++
	}
	for _,x:=range Split(s,"B") {
		if len(x)>1 {
			c+=len(x)-1
		} else {
			c-=len(x)
		}
	}
	c+=Count(s,"AB")
	c+=Count(s,"BA")
	Println(c)
}
0