6 kyu

myjinxin's Fairy tales #003 : Ali Baba and the Forty Thieves II

Description:

Story

The Ali Baba took away the robber's treasure, and unfortunately, he was found by the robbers. The robbers was determined to get revenge on the Alibaba.

They sent two minions, secretly get the address of the Ali Baba and Left some special mark on his house. When waiting for the night, the robbers will be in accordance with the guidelines mark find out Ali Baba and kill him.

Poor Ali Baba! What should he do?

Smart Ali Baba think of a good way, he was also left the same mark on the neighborhoods' house. In this way, the robbers can't find the residence of the Ali Baba.

Descrption

The special mark like this:

aliBaba="A*l#i@B!a%b&a"

The special characters between the name is the special marks. We needs help Ali Baba left the same marks on his neighborhoods' house.

neighborhoods=["JohnSmith","MichaelJackson","JamesBond"]

result should be:
["J*o#h@n!S%m&ith","M*i#c@h!a%e&lJackson","J*a#m@e!s%B&ond"]

As you can see, the rule is insert the same special characters to the same position. More examples:

aliBaba="A-li--Bab---a"
neighborhoods=["JohnSmith","MichaelJackson","JamesBond"]
result should be:
["J-oh--nSm---ith","M-ic--hae---lJackson","J-am--esB---ond"]

aliBaba="(((Ali|||Baba)))"
neighborhoods=["JohnSmith","MichaelJackson","JamesBond"]
result should be:
["(((Joh|||nSmi)))th","(((Mic|||hael)))Jackson","(((Jam|||esBo)))nd"]

test with shorter names:
aliBaba="(A)(l)(i)(B)(a)(b)(a)"
neighborhoods=["Adam","Eva","Snake","Apple"]
result should be:
["(A)(d)(a)(m)()()()","(E)(v)(a)()()()()","(S)(n)(a)(k)(e)()()()","(A)(p)(p)(l)(e)()()()"]

Task

Complete function sameMark that accepts 2 arguments aliBaba and neighborhoods. Returns the result in accordance with the rules above.

Puzzles

Stats:

CreatedSep 18, 2016
PublishedSep 18, 2016
Warriors Trained145
Total Skips2
Total Code Submissions175
Total Times Completed75
JavaScript Completions75
Total Stars5
% of votes with a positive feedback rating97% of 32
Total "Very Satisfied" Votes30
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes0
Total Rank Assessments5
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • Voile Avatar
  • user9644768 Avatar
Ad