mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
568 B
43 lines
568 B
5 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
5 years ago
|
|
||
|
"github.com/01-edu/z01"
|
||
5 years ago
|
)
|
||
|
|
||
|
func solve(str string) bool {
|
||
|
arr := make([]int, 26)
|
||
|
for i := 0; i < len(str); i++ {
|
||
|
arr[str[i]-'a']++
|
||
|
}
|
||
|
for i := 0; i < 26; i++ {
|
||
|
for j := i + 1; j < 26; j++ {
|
||
|
if arr[i] == arr[j] && arr[i] != 0 {
|
||
|
return false
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
func print(str string) {
|
||
|
for _, v := range str {
|
||
|
z01.PrintRune(v)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
args := os.Args[1:]
|
||
|
if len(args) != 1 {
|
||
|
z01.PrintRune('\n')
|
||
|
return
|
||
|
}
|
||
|
result := solve(args[0])
|
||
|
if result {
|
||
|
print("true\n")
|
||
|
} else {
|
||
|
print("false\n")
|
||
|
}
|
||
|
}
|