ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
package main
import (
"bufio"
"fmt"
"os"
"sort"
)
func main() {
var n int
reader := bufio.NewReader(os.Stdin)
fmt.Fscanln(reader, &n)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var words = make([]string, n)
for i := 0; i < n; i++ {
fmt.Fscanln(reader, &words[i])
}
sort.Slice(words, func(i, j int) bool {
if len(words[i]) < len(words[j]) {
return true
} else if len(words[i]) == len(words[j]) {
return words[i] < words[j]
} else {
return false
}
})
for i := 0; i < n; i++ {
if i > 0 && words[i-1] == words[i] {
continue
}
fmt.Fprintln(writer, words[i])
}
}
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 15649๋ฒ / N๊ณผ M (1) [Go] (0) | 2020.07.19 |
---|---|
BOJ / 10814๋ฒ / ๋์ด์ ์ ๋ ฌ [Go] (0) | 2020.07.18 |
BOJ / 11651๋ฒ / ์ขํ ์ ๋ ฌํ๊ธฐ 2 [Go] (0) | 2020.07.14 |
BOJ / 11650๋ฒ / ์ขํ ์ ๋ ฌํ๊ธฐ [Go] (0) | 2020.07.13 |
BOJ / 1427๋ฒ / ์ํธ์ธ์ฌ์ด๋ [Golang] (0) | 2020.07.12 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- baekjoon
- ์ด๋ถํ์
- ๋ฐฑ์ค
- Macbook pro 2012 mid 13
- BFS
- ์๊ฐ๊ต์ฒด
- ๋ชฝ๊ณ ๋๋น
- ๋งฅ๋ถ
- ํ๋ก์ด๋์์ฌ
- ์๋ฐ
- go
- ํ
- ์๊ณ ๋ฆฌ์ฆ
- AWS
- MongoDB
- ๋ธ๋ฃจํธํฌ์ค
- ๋ถํ ์ ๋ณต
- ์คํ
- java
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- Golang
- BOJ
- ํด์๋งต
- ballet
- python3
- dp
- Algorithm
- dfs
- ๋ฐ๋
- ๋งฅ๋ถํ๋ก
- Total
- Today
- Yesterday