Is one string contained within the other?

1

Given two inputs, you should print or return whether the characters in the first string are - in order - inside the second string.

For example, we want to check whether the string hello, taken as the first input, and the sample text (the second input) is abhcedddldddloallllll.

This should output a truthy value, as the first input is in the second input. I will highlight it like this:

abhcedddldddloallllll

Examples:

hello
abhcedddldddoallllll

0 (not enough 'l's - the last few 'l's don't count because they're after the 'o')

hello
ahaecldleldo

1 (the multiple 'l's are fine)

foo
adasdasdsadasdasdasdasfsadasdasoddddddo

1

bar
aaabaaaarrrrra

1

bob
bob

1

You may, of course use other truthy or falsy values, and, of course, exclude text in brackets in your output.

You will only receive printable ASCII characters as input (that is, no whitespace or characters such as µ)

The shortest answer in bytes wins!

Rudraksh Gandhar

Posted 2017-03-13T10:19:01.620

Reputation: 19

Question was closed 2017-04-05T19:41:49.920

And the result of that example would be…? – manatwork – 2017-03-13T10:24:17.157

3

Welcome on PPCG. As it's currently written, the challenge is very unclear, and lack a victory criterion. I recommend you have a look at other challenges on this site to see how it's done usually, and then post your challenge in the Sandbox to get help from the community to improve it.

– Dada – 2017-03-13T10:25:58.407

Not sure whether unclarity (sounds pretty clear he wants 'abcnjhgahgjhfhaljhrkhgrbhjbevfho'[/n.*a.*g.*a.*r.*r.*o/]) is the biggest issue. The challenge looks very familiar, just can't find its duplicate. – manatwork – 2017-03-13T10:29:59.743

1I made some relatively major changes, feel free to edit if I did anything wrong. – Okx – 2017-03-13T11:04:20.630

10Duplicate. – Martin Ender – 2017-03-13T11:19:48.713

@MartinEnder Now that it's no longer "unclear", can the close reason be changed to "duplicate"? – mbomb007 – 2017-04-05T19:39:23.800

No answers