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.
52 lines
558 B
52 lines
558 B
![]()
5 years ago
|
package main
|
||
|
|
||
|
import (
|
||
![]()
4 years ago
|
"fmt"
|
||
![]()
5 years ago
|
"os"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
if len(os.Args) != 3 {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
first := os.Args[1]
|
||
|
second := os.Args[2]
|
||
|
|
||
|
if first == "" {
|
||
![]()
4 years ago
|
fmt.Println("1")
|
||
![]()
5 years ago
|
return
|
||
|
}
|
||
|
if second == "" {
|
||
![]()
4 years ago
|
fmt.Println("0")
|
||
![]()
5 years ago
|
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) {
|
||
![]()
4 years ago
|
fmt.Println("1")
|
||
![]()
5 years ago
|
} else {
|
||
![]()
4 years ago
|
fmt.Println("0")
|
||
![]()
5 years ago
|
}
|
||
|
}
|