Back
Close

Unflip the URLs

Statement

 Goal

For some reason, my computer has flipped each subsection ('word') of all my bookmarked URLs.
Instead of https://www.codingame.com/clashofcode it reads sptth://www.emagnidoc.moc/edocfohsalc.

Strangely, instead of flipping the whole URL it has individually flipped every 'word' of alphanumeric characters (underscores and dashes also count as 'word' characters) and left all non-alphanumeric characters (excluding underscores and dashes) in their place.
(e.g. fake.com/test-this_word -> ekaf.moc/drow_siht-tset - dashes and underscores are treated as part of the subsections/'words' that are flipped)

Please flip the input URL back into a readable format!
Input
One Line: A flipped URL to have it's subsections un-flipped
Output
One Line: The un-flipped url
Constraints
All valid URL characters may be used, including %, &, +, etc.

Each symbol other than _ and - should be kept in place and not part of the 'words' that need to be flipped.

e.g. 'this_word-is_one-word' but 'these#are%four+words' -> 'drow-eno_si-drow_siht' and 'eseht#era%ruof+sdrow'
Example
Input
sptth://www.emagnidoc.moc/edocfohsalc
Output
https://www.codingame.com/clashofcode

Game modes
FastestShortest

Test cases
Test 1 Test
Input
sptth://www.emagnidoc.moc/edocfohsalc
Output
https://www.codingame.com/clashofcode

Validator 1 Validator
Input
sptth://oit.nur/#ybur
Output
https://tio.run/#ruby

Test 2 Test
Input
sptth://www.elgoog.moc/hcraes?q=si+elgoog+lagelli+ni+ecnarf%F3
Output
https://www.google.com/search?q=is+google+illegal+in+france%3F

Validator 2 Validator
Input
www.lruekaf.moc/serocsrednu_fo_esu_elbanoitseuq
Output
www.fakeurl.com/questionable_use_of_underscores

Test 3 Test
Input
sptth://www.ymedu.moc/esruoc/esruoc-repoleved-sliar-no-ybur-etelpmoc-eht/l
Output
https://www.udemy.com/course/the-complete-ruby-on-rails-developer-course/l

Validator 3 Validator
Input
sptth://resurepus.moc/snoitseuq/012298/emorhc-elgoog-htiw-slru-fo-dne-ta-erocsrednu/5593301
Output
https://superuser.com/questions/892210/underscore-at-end-of-urls-with-google-chrome/1033955

Test 4 Test
Input
sptth://www.tidder.moc/r/eceiPenO/
Output
https://www.reddit.com/r/OnePiece/

Validator 4 Validator
Input
sptth://www.lloryhcnurc.moc/eceip-eno/376056-setarip-eht-fo-gnik-eb-annog-sohw-nam-eht-yfful-mi-1-edosipe
Output
https://www.crunchyroll.com/one-piece/episode-1-im-luffy-the-man-whos-gonna-be-king-of-the-pirates-650673

Test 5 Test
Input
sptth://emtsujroenoyreverofnwod.moc/emagnidoc.moc
Output
https://downforeveryoneorjustme.com/codingame.com

Validator 5 Validator
Input
sptth://rettiwt.moc/cioreHmiYEH/sutats/3293302220686495431
Output
https://twitter.com/HEYimHeroic/status/1345946860222033923

Solution language

Solution

Stub generator input
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants