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.
28 lines
1.0 KiB
28 lines
1.0 KiB
6 years ago
|
## hiddenp
|
||
|
|
||
|
### Instructions
|
||
|
|
||
5 years ago
|
Write a program named `hiddenp` that takes two `string` and that, if the first `string` is hidden in the second one, displays `1` followed by a newline (`'\n'`), otherwise it displays `0` followed by a newline.
|
||
6 years ago
|
|
||
5 years ago
|
Let s1 and s2 be `string`. It is considered that s1 is hidden in s2 if it is possible to find each character from s1 in s2, **in the same order as they appear in s1.**
|
||
6 years ago
|
|
||
5 years ago
|
If s1 is an empty `string` it is considered hidden in any `string`.
|
||
6 years ago
|
|
||
5 years ago
|
If the number of arguments is different from 2, the program displays nothing.
|
||
6 years ago
|
|
||
5 years ago
|
### Usage
|
||
6 years ago
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/hiddenp$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/hiddenp$ ./hiddenp "fgex.;" "tyf34gdgf;'ektufjhgdgex.;.;rtjynur6" | cat -e
|
||
6 years ago
|
1$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/hiddenp$ ./hiddenp "abc" "2altrb53c.sse" | cat -e
|
||
6 years ago
|
1$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/hiddenp$ ./hiddenp "abc" "btarc" | cat -e
|
||
6 years ago
|
0$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/hiddenp$ ./hiddenp "DD" "DABC" | cat -e
|
||
|
0$
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/hiddenp$ ./hiddenp
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/hiddenp$
|
||
6 years ago
|
```
|