1
\$\begingroup\$

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!

\$\endgroup\$
6
  • \$\begingroup\$ And the result of that example would be…? \$\endgroup\$ Commented Mar 13, 2017 at 10:24
  • 3
    \$\begingroup\$ 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. \$\endgroup\$ Commented Mar 13, 2017 at 10:25
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Mar 13, 2017 at 10:29
  • 1
    \$\begingroup\$ I made some relatively major changes, feel free to edit if I did anything wrong. \$\endgroup\$ Commented Mar 13, 2017 at 11:04
  • 10
    \$\begingroup\$ Duplicate. \$\endgroup\$ Commented Mar 13, 2017 at 11:19

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.