package main
import (
"fmt"
"regexp"
)
func main() {
str := "What??? Why?? How?????"
// Compile the regex to match one or more '?'
re := regexp.MustCompile(`\?+`)
// Replace matches with a single '?'
result := re.ReplaceAllString(str, "?")
fmt.Println(result)
}
/*
run:
What? Why? How?
*/