Bubble tea toppings are written as one string separated by commas, like "pearls,jelly,pudding". Write CountToppings(order) to return how many toppings there are. No toppings is the empty string "", which gives 0.
CountToppings("pearls,jelly,pudding")→3CountToppings("")→0func CountToppings(order string) intpackage main
import "strings"
func CountToppings(order string) int {
count := 0
if order != "" {
// your code here: split order at the commas; count is the number of pieces
}
return count
}
Run tries the examples. When they look right, Submit.