package main import . "fmt" import . "strings" func main() { var n,s string Scan(&n,&s) b:=[]byte(s) var c int if Contains(s,"BB") { c++ } for i,x:=range b[1:] { y:=b[i] if x=='A'||y=='A' { c++ if x!=y { b[i+1]='B' } } } Println(c) }