Skip to content

Commit f460d39

Browse files
authored
Merge pull request #1 from ehsan-a-kian/AlphabetSoup
AlphabetSoup resolved
2 parents aff6bad + af56dcd commit f460d39

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/easy/AlphabetSoup.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"sort"
6+
"strings"
7+
)
8+
9+
// AlphabetSoup takes the str string parameter and returns the string with the letters in alphabetical order
10+
func AlphabetSoup(str string) string {
11+
letters := strings.Split(str, "")
12+
sort.Strings(letters)
13+
return strings.Join(letters, "")
14+
}
15+
16+
func main() {
17+
result1 := AlphabetSoup("leftfield")
18+
fmt.Println(result1)
19+
result2 := AlphabetSoup("underworld")
20+
fmt.Println(result2)
21+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy