AlgoUniversity
  • Go Back
Discussion
Modify Variable Names :

Author

Ayush Gangwani

Difficulty Level : Easy

Submissions : 86

Asked In : Nagarro

Marks :10

: 0 | : 0

You are given a string $$$S$$$ representing a variable name in either C++ or Java as per the following rules :

  • In C++, variables are named using snake_case, i.e., spaces between multiple words are replaced by an underscore '_' character, and the first letter of each word is written in lowercase. For example, my_variable is a valid C++ variable name.
  • In Java, variables are named using camelCase, which indicates the separation of words with a single capitalized letter, and the first word starting with lower case. For example, myVariable is a valid Java variable name.

Note : Assume that a Java variable name never contains '_' before any alphabet. In other words, if the given variable name contains '_' before any alphabet, treat the given variable name as a C++ variable name and vice versa.

Your task is to convert a C++ variable name into a Java variable name and vice versa.

Input

The first line of input contains an integer $$$t \hspace{2 pt}(1 \le t \le 10^4)$$$ — the number of testcases. The description of $$$t$$$ testcases follows.

The first line of each testcase contains an integer $$$n \hspace{2 pt} (1 \le n \le 10^5)$$$ — the length of string $$$S$$$.

The second line of each testcase contains a string of length $$$n$$$ denoting the variable name in either C++ or Java.

The strings consist of lowercase and uppercase latin letters and underscores '_' and it is guaranteed that the sum of lengths of strings over all testcases does not exceed $$$10^5$$$.

Output

For each testcase, print the converted variable name in a single line.

Example

Input
2
15
thisIsAVariable
18
this_is_a_variable
Output
this_is_a_variable
thisIsAVariable

Note

In sample testcase 1, the given string is a Java variable name and hence we convert it into C++ variable name separating the words with underscores.

In sample testcase 2, the given string is a C++ variable name and hence we convert it into Java variable name by using camelCase notation. Note that "ThisIsAVariable" is not a valid Java variable name.

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.