PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
This is my answer to :
CHALLENGE: Strings stuff
proposed by QuentinJanuel
https://www.sololearn.com/Discuss/993086/challenge-strings-stuff
Hi there, I found a challenge for you:
The function takes 2 strings and returns false only if there is no way for you to:
- choose a character index in the 2nd string as your starting point,
- keep moving to the right or left char,
- keep going until you eventually have read the 1st string.
For instance:
- "dcdcb" in "abcde", I can start at the 4th char ("d"), and do the following moves: ←→←←, so that at the end I got "dcdcb". It is possible, returns true.
- "ac" in "abc", no solution exists, it returns false.
Good luck!"""
# ---------------------------------------
# ---------------------------------------
# test cases :
testcases = [["kayaks", "skay"],["bit", "bite"],["code", "coddle"],["atatata", "ta"],["trirtotrtopip", "tptirtopit"], ["abcbcbab", "abcba...cba"]]
# function :
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run