Topcoder Member SRM 474 "PalindromesCount"
問題:http://www.topcoder.com/stat?c=problem_statement&pm=10803 (要ログイン)
Go言語で書く練習.
スライスを使ってみる.
func IsPalindrom(s string) bool { for i:=0;i<len(s)/2;i++{ if s[i]!=s[len(s)-i-1]{ return false } } return true } func Count(A,B string) (count int) { for p:=0;p<=len(A);p++{ if IsPalindrom(A[0:p]+B+A[p:len(A)]){ count++ } } return }