Back
Close

Rename from camelCase to snake_case

Statement

 Goal

Given a list of files, you have to change the file name of only .jpg and .png files from the camelCase style to snake_case style. Files with any other extension should not be changed.
Input
Line 1: An integer N for the number of lines you should read below.
Next N lines: F relative path + file name.
Output
N lines: F relative path + file name with the requested changes, in the same order as the input.
Constraints
3 ≤ N ≤ 7
camelCase file names are guaranteed to start with a lowercase letter.
Example
Input
3
images/beachTrip.jpg
newFolder/oakTree.png
images/highShool.eps
Output
images/beach_trip.jpg
newFolder/oak_tree.png
images/highShool.eps

Game modes
FastestShortest

Test cases
Test 1 Test
Input
3 images/beachTrip.jpg newFolder/oakTree.png images/highShool.eps
Output
images/beach_trip.jpg newFolder/oak_tree.png images/highShool.eps

Validator 1 Validator
Input
3 kkkkkk/aaaaBccccc.jpg jjjjjj/cdefGhajsd.png aaaaaaa/qweqQqwee.eps
Output
kkkkkk/aaaa_bccccc.jpg jjjjjj/cdef_ghajsd.png aaaaaaa/qweqQqwee.eps

Test 2 Test
Input
4 SmartPhone/beautifulRainbow.png SmartPhone/hot_air_balloon.png myDownloads/archiveTest.zip new_folder/myZip.zip
Output
SmartPhone/beautiful_rainbow.png SmartPhone/hot_air_balloon.png myDownloads/archiveTest.zip new_folder/myZip.zip

Validator 2 Validator
Input
4 SmartPhone/lufituaebRwobnia.png SmartPhone/toh_ria_noollab.png myDownloads/archiveTest.zip new_folder/myZip.zip
Output
SmartPhone/lufituaeb_rwobnia.png SmartPhone/toh_ria_noollab.png myDownloads/archiveTest.zip new_folder/myZip.zip

Test 3 Test
Input
4 playTestCase/failureFoundExpected.png wonders/clearWaterWaterfall.png notImages/helloWorld.zip camelCase/snake_case.js
Output
playTestCase/failure_found_expected.png wonders/clear_water_waterfall.png notImages/helloWorld.zip camelCase/snake_case.js

Validator 3 Validator
Input
4 kxjbTwuaChks/fmdFvmwbEjnjmbbn.png bthxqtp/pbmbtWitbwWfkrdkdrk.png iwbIpemsc/yxnbrWbcer.zip bectiCxxu/kvecc_jbus.py
Output
kxjbTwuaChks/fmd_fvmwb_ejnjmbbn.png bthxqtp/pbmbt_witbw_wfkrdkdrk.png iwbIpemsc/yxnbrWbcer.zip bectiCxxu/kvecc_jbus.py

Test 4 Test
Input
7 sevenWondersOfTheWorld/greatWallOfChina.png sevenWondersOfTheWorld/christTheRedeemerStatue.png sevenWondersOfTheWorld/machuPicchu.png sevenWondersOfTheWorld/chichenItza.png sevenWondersOfTheWorld/theRomanColosseum.png sevenWondersOfTheWorld/tajMahal.png sevenWondersOfTheWorld/petra.png
Output
sevenWondersOfTheWorld/great_wall_of_china.png sevenWondersOfTheWorld/christ_the_redeemer_statue.png sevenWondersOfTheWorld/machu_picchu.png sevenWondersOfTheWorld/chichen_itza.png sevenWondersOfTheWorld/the_roman_colosseum.png sevenWondersOfTheWorld/taj_mahal.png sevenWondersOfTheWorld/petra.png

Validator 4 Validator
Input
7 ynwqgWhxgxypOzTnwWtfob/ymcwsWkqbOoCidtd.png yvahrWgiibocOwTqvWopxt/celsebTiaRwvwuxxkSucdij.png tjxclWdidhepOeTugWnsgi/ilatbPcgjus.png uuzjtWwptzsaOuTnjWtpoz/bygyjxfIuwy.png mgjkoWpmctepOfTqxWqeba/mjrRiodeChxchrqwr.png kgaodWfenrvjOiTncWgbrf/bqiMcvok.png psukiWwstwvvOeThxWoewv/psskg.png
Output
ynwqgWhxgxypOzTnwWtfob/ymcws_wkqb_oo_cidtd.png yvahrWgiibocOwTqvWopxt/celseb_tia_rwvwuxxk_sucdij.png tjxclWdidhepOeTugWnsgi/ilatb_pcgjus.png uuzjtWwptzsaOuTnjWtpoz/bygyjxf_iuwy.png mgjkoWpmctepOfTqxWqeba/mjr_riode_chxchrqwr.png kgaodWfenrvjOiTncWgbrf/bqi_mcvok.png psukiWwstwvvOeThxWoewv/psskg.png

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