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.
32 lines
464 B
32 lines
464 B
5 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"os"
|
||
|
)
|
||
|
|
||
5 years ago
|
func ok(s1 string, s2 string) bool {
|
||
|
runes1 := []rune(s1)
|
||
|
runes2 := []rune(s2)
|
||
5 years ago
|
var rest string
|
||
|
count := 0
|
||
5 years ago
|
for i := 0; i < len(runes1); i++ {
|
||
|
for j := count; j < len(runes2); j++ {
|
||
|
if runes1[i] == runes2[j] {
|
||
|
rest += string(runes1[i])
|
||
|
j = len(runes2) - 1
|
||
5 years ago
|
}
|
||
|
count++
|
||
|
}
|
||
|
}
|
||
5 years ago
|
return s1 == rest
|
||
5 years ago
|
}
|
||
|
|
||
|
func main() {
|
||
|
if len(os.Args) == 3 {
|
||
5 years ago
|
if ok(os.Args[1], os.Args[2]) {
|
||
|
fmt.Println(os.Args[1])
|
||
|
}
|
||
5 years ago
|
}
|
||
|
}
|