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.
47 lines
688 B
47 lines
688 B
package main |
|
|
|
import ( |
|
student "student" |
|
|
|
"github.com/01-edu/public/go/tests/lib" |
|
) |
|
|
|
func rot14(s string) (result string) { |
|
for _, r := range s { |
|
if r >= 'a' && r <= 'z' { |
|
if r >= 'm' { |
|
r -= 12 |
|
} else { |
|
r += 14 |
|
} |
|
} else if r >= 'A' && r <= 'Z' { |
|
if r >= 'M' { |
|
r -= 12 |
|
} else { |
|
r += 14 |
|
} |
|
} |
|
result += string(r) |
|
} |
|
return result |
|
} |
|
|
|
func main() { |
|
type nodeTest struct { |
|
data []string |
|
} |
|
|
|
table := []nodeTest{} |
|
for i := 0; i < 5; i++ { |
|
val := nodeTest{ |
|
data: lib.MultRandWords(), |
|
} |
|
table = append(table, val) |
|
} |
|
|
|
for _, arg := range table { |
|
for _, s := range arg.data { |
|
lib.Challenge("Rot14", rot14, student.Rot14, s) |
|
} |
|
} |
|
}
|
|
|