package main import . "fmt" func main() { var s string Scan(&s) var dp [9][8]int dp[0][0]=1 for i,c:=range s { var x int switch c { case 'l','o': x=1 case 'a','s': x=2 } for k,v:=range dp[i][:] { if x>0 { dp[i+1][k|x]+=v } dp[i+1][k|4]+=v } } Println(dp[8][7]) }