about | help | code help+videos | done | prefs |
Write a method that returns a string based on 'str' but with every other character replaced by the "_" (underscore) character. Look at the test data for examples. Hint: Look carefully at the final character in the resulting string and make sure you understand where it came from. test2023_01_19_APP1SLHL_alternate("spicy food") → "s_i_y_f_o_" test2023_01_19_APP1SLHL_alternate("I hope you all get this right!") → "I_h_p_ _o_ _l_ _e_ _h_s_r_g_t_" test2023_01_19_APP1SLHL_alternate("There once was a bee named Bea. She wanted to go see the sea. She brought along a friend; so those two went to the sea in the end. There a tern took a turn and munched on Bea and her friend.") → "T_e_e_o_c_ _a_ _ _e_ _a_e_ _e_._ _h_ _a_t_d_t_ _o_s_e_t_e_s_a_ _S_e_b_o_g_t_a_o_g_a_f_i_n_;_s_ _h_s_ _w_ _e_t_t_ _h_ _e_ _n_t_e_e_d_ _T_e_e_a_t_r_ _o_k_a_t_r_ _n_ _u_c_e_ _n_B_a_a_d_h_r_f_i_n_." ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 230
Copyright Nick Parlante 2017 - privacy