# Remove the First Capital Letter From Each Element HackerRank Solution

#### ByBrokenprogrammers

Dec 11, 2022

Hello Programmers, In this post, you will know how to solve the Remove the First Capital Letter From Each Element HackerRank Solution. This problem is a part of the HackerRank Linux Shell Series.

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.

## Remove the First Capital Letter From Each Element HackerRank Solution

### Objective

In this challenge, we practice reading and transforming arrays.

You are given a list of countries, each on a new line. Your task is to read them into an array and then transform them in the following way:

The first capital letter (if present) in each element of the array should be replaced with a dot (‘.‘). Then, display the entire array with a space between each country’s names.

Input Format

The input format consists of a list of country names each on a separate line. The only characters present in the country names will be upper or lower case characters and hyphens.

Output Format

Transform the names as described and display the entire array of country names with a space between each of them.

Sample Input

Namibia
Nauru
Nepal
Netherlands
NewZealand
Nicaragua
Niger
Nigeria
NorthKorea
Norway

Sample Output

.amibia .auru .epal .etherlands .ewZealand .icaragua .iger .igeria .orthKorea .orway

Explanation

The first capital letter of each name has been replaced with a dot (‘.‘).

### Remove the First Capital Letter From Each Element HackerRank Solutions

```#You are given a list of countries, each on a new line. Your task is to read them into an array and then transform them in the following way:The first capital letter (if present) in each element of the array should be replaced with a dot ('.'). Then, display the entire array with a space between each country's names.
arr=(\$(cat))
echo \${arr[@]/[A-Z]/.}```

Note: This problem (Remove the First Capital Letter From Each Element) is generated by HackerRank but the Solution is Provided by  BrokenProgrammers. This tutorial is only for Educational and Learning purposes.