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.
59 lines
674 B
59 lines
674 B
5 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
|
||
|
"github.com/01-edu/z01"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
if len(os.Args) != 3 {
|
||
|
z01.PrintRune('\n')
|
||
|
return
|
||
|
}
|
||
|
|
||
|
first := os.Args[1]
|
||
|
second := os.Args[2]
|
||
|
|
||
|
if first == "" {
|
||
|
z01.PrintRune('1')
|
||
|
z01.PrintRune('\n')
|
||
|
return
|
||
|
}
|
||
|
if second == "" {
|
||
|
z01.PrintRune('0')
|
||
|
z01.PrintRune('\n')
|
||
|
return
|
||
|
}
|
||
|
|
||
|
i := 0
|
||
|
j := 0
|
||
|
count := 0
|
||
|
|
||
|
firstA := []rune(first)
|
||
|
secondA := []rune(second)
|
||
|
|
||
|
for i < len(first) {
|
||
|
for j < len(second) {
|
||
|
if firstA[i] == secondA[j] {
|
||
|
count++
|
||
|
i++
|
||
|
}
|
||
|
if i == len(first) {
|
||
|
break
|
||
|
}
|
||
|
j++
|
||
|
}
|
||
|
i++
|
||
|
}
|
||
|
|
||
|
if count == len(first) {
|
||
|
z01.PrintRune('1')
|
||
|
|
||
|
} else {
|
||
|
z01.PrintRune('0')
|
||
|
}
|
||
|
z01.PrintRune('\n')
|
||
|
|
||
|
}
|