Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият.
Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание.
Използваме бисквитки и за измерване на маркетинговите ни усилия.
Аз съм я решила по два начина, коментарите във форума са общо взето за първия , с лист. Не можах да намеря къде греша в решението си с Map. Ето го условието:
Programming Fundamentals Final Exam Retake 10.04.2020
Problem 2. Mirror words
The SoftUni Spelling Bee competition is here. But it`s not like any other Spelling Bee competition out there, it`s different and a lot more fun! You, of course, are a participant and you are eager to show the competition that you are the best, so go ahead, learn the rules and win!
On the first line of the input you will be given a text string. In order to win the competition you have to find all hidden word pairs, read them and mark the ones that are mirror images of each other.
First of all you have to extract the hidden word pairs. Hidden word pairs are:
If the second word, spelled backwards is the same as the first word and vice versa (casing matters!), then they are a match and you have to store them somewhere. Examples of mirror words:
#Part##traP# @leveL@@Level@ #sAw##wAs#
"The mirror words are:
{wordOne} <=> {wordtwo}, {wordOne} <=> {wordtwo}, {wordOne} <=> {wordtwo}, etc…"
Input / Constraints
Output
Examples
Input
@mix#tix3dj#poOl##loOp#wl@@bong&song%4very$long@thong#Part##traP##@@leveL@@Level@##car#rac##tu@pack@@ckap@#rr#sAw##wAs#r#@w1r
Output
Comments
5 word pairs found!
The mirror words are:
Part <=> traP, leveL <=> Level, sAw <=> wAs
There are 5 green and yellow pairs that meet all requirements and thus are valid.
#poOl##loOp# is valid and looks very much like a mirror words pair but it isn`t because the casings don`t match.
#car#rac# “rac” spelled backwards is "car" but this is not a valid pair because there is only one "#" between the words.
@pack@@ckap@ is also valid but "ckap" backwards is "pakc" which is not the same as "pack", so they are not mirror words.
Input
#po0l##l0op# @bAc##cAB@ @LM@ML@ #xxxXxx##xxxXxx# @aba@@ababa@
Output
Comments
2 word pairs found!
No mirror words!
"xxxXxx" backwards is not the same as "xxxXxx"
@aba@@ababa@ is a valid pair but the word lengths are different, thus these are definitely not mirror words
Input
#lol#lol# @#God@@doG@# #abC@@Cba# @Xyu@#uyX#
Output
Comments
No word pairs found!
No mirror words!
JavaScript Input
[
'@mix#tix3dj#poOl##loOp#wl@@bong&song%4very$long@thong#Part##traP##@@leveL@@Level@##car#rac##tu@pack@@ckap@#rr#sAw##wAs#r#@w1r'
]
Output
Comments
5 word pairs found!
The mirror words are:
Part <=> traP, leveL <=> Level, sAw <=> wAs
There are 5 green and yellow pairs that meet all requirements and thus are valid.
#poOl##loOp# is valid and looks very much like a mirror words pair but it isn`t because the casings don`t match.
#car#rac# “rac” spelled backwards is "car" but this is not a valid pair because there is only one "#" between the words.
@pack@@ckap@ is also valid but "ckap" backwards is "pakc" which is not the same as "pack", so they are not mirror words.
JavaScript Input
[ '#po0l##l0op# @bAc##cAB@ @LM@ML@ #xxxXxx##xxxXxx# @aba@@ababa@' ]
Output
Comments
2 word pairs found!
No mirror words!
"xxxXxx" backwards is not the same as "xxxXxx"
@aba@@ababa@ is a valid pair but the word lengths are different, thus these are definitely not mirror words
JavaScript Input
[ '#lol#lol# @#God@@doG@# #abC@@Cba# @Xyu@#uyX#' ]
Output
Comments
No word pairs found!
No mirror words!