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.
Similar Kata:
Stats:
Created | Sep 18, 2016 |
Published | Sep 18, 2016 |
Warriors Trained | 145 |
Total Skips | 2 |
Total Code Submissions | 175 |
Total Times Completed | 75 |
JavaScript Completions | 75 |
Total Stars | 5 |
% of votes with a positive feedback rating | 97% of 32 |
Total "Very Satisfied" Votes | 30 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 5 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |