We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# Read the inputcountries=()whileIFS=read-rcountry;docountries+=("$country")done# Filter out names containing 'a' or 'A'filtered_countries=()forcountryin"${countries[@]}";dofirst_letter="."rest_of_word="${country:1}"filtered_countries+=("${first_letter^}${rest_of_word}")done# Print the filtered countriesforcountryin"${filtered_countries[@]}";doecho-n"$country "done
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Remove the First Capital Letter from Each Element
You are viewing a single comment's thread. Return to all comments →