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.
42 lines
546 B
42 lines
546 B
5 years ago
|
package main
|
||
|
|
||
|
import (
|
||
5 years ago
|
"fmt"
|
||
5 years ago
|
"os"
|
||
|
)
|
||
|
|
||
|
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 {
|
||
5 years ago
|
fmt.Printf("%c", v)
|
||
5 years ago
|
}
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
args := os.Args[1:]
|
||
|
if len(args) != 1 {
|
||
5 years ago
|
fmt.Println()
|
||
5 years ago
|
return
|
||
|
}
|
||
|
result := solve(args[0])
|
||
|
if result {
|
||
|
print("true\n")
|
||
|
} else {
|
||
|
print("false\n")
|
||
|
}
|
||
|
}
|