= 0; $i--) { if ($s[$i] == 'w') { $cntW++; continue; } else if ($s[$i] == 'c') { $ans += $cntW * ($cntW - 1) / 2; } } print $ans; ?>