How to find, given a sentence, the acronym of that sentence using GO programming language. For example, “Hello, world!” becomes “HW”. So far I have tried splitting the sentence:
package main
import (
"bufio"
"fmt"
"strings"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
fmt.Print("Enter text: ")
text, _ := reader.ReadString('\n')
fmt.Print(strings.Split(text," "))
fmt.Print(strings.Index(text, ))
}
- Took input from the user
- Split on the occurrence of white space.
- What next?
Any help is appreciated.
Thanks