Last active
October 8, 2018 10:18
-
-
Save nikita8/e0810f0e431d0bff08aae40c342cc34e to your computer and use it in GitHub Desktop.
W06::C01 Generate acronym from the input string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
"strings" | |
) | |
func main() { | |
reader := bufio.NewReader(os.Stdin) | |
fmt.Print("Enter input text: ") | |
testString, _ := reader.ReadString('\n') | |
testArray := strings.Fields(testString) | |
var firstLetter string | |
for _, v := range testArray { | |
firstLetter += v[:1] | |
} | |
firstLetter = strings.ToUpper(firstLetter) | |
fmt.Println(firstLetter) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment