Question
CAPTCHA is a service that is used to know whether app users are humans or bots. This includes clicking in a specific area, entering the
CAPTCHA is a service that is used to know whether app users are humans or bots. This includes clicking in a specific area, entering the given numbers in text box, selecting the mentioned things from the pictures etc. But company XYZ wanted to update the CAPTCHA pattern for high security. Scientific notation, also known as standard form or exponential notation, is a way to write very large or very small numbers in a more compact and manageable form. In scientific notation, nonzero numbers are written in the form m 10 or m times ten raised to the power of n, where n is an integer, and the coefficient m is a nonzero real number (usually between 1 and 10 in absolute value, and nearly always written as a terminating decimal). Tina, a developer, is working on creating a CAPTCHA system that requires a high level of human engagement i.e., from the given number one has to perform some operations on it and then enter the result in the text box provided. The rules for generating the password are given below. You will receive a numerical value. Transform the provided decimal number into scientific notation. Simplify all the digits after the decimal point to a single digit by adding all the digits until it becomes single digit, and apply the same rule to the exponent. Next, create a string by concatenating the first three letters of each digit when expressed as words, while keeping the symbols and letter 'e' unchanged. This resultant string will be denoted as S1. If the digit resulting from reducing the value of exponent to a single digit is odd, concatenate all the letters at odd positions in the given name (using 1-based indexing). This string is referred to as S2. Your desired password will be the combination of S1 and S2, separated by an "@" symbol, forming the format S1@S2. Given t number of test cases. In each test cases there is an integer / decimal number and the name of the person who is trying to resolve the CAPTCHA. Print the correct password in each test case. In case of invalid number, print "Invalid input". Note: Some additional rules in this problem are: If the given number is 3, scientific notation will be 3.0e0. If the given number is 323, scientific notation will be 3.23e+2 Mathematically, the decimal number 0437 represents 437.
Constraints 1 <= len(name) <= 100 1 <= len(number) <= 100 1 <= T <= 10 Number can be negative. There will be no spaces in the given name. Name will be consisting of only lower case letters. If not, consider invalid.
Input The first line consists of T, number of test cases. Next T lines contain number and name separated by space.
Output Print the password for each test case in a new line.
Time Limit (secs) 1
Examples Example 1 Input 2 054785949 rajarajeswari 00.00000934749 bhuvaneswari Output fiv.onee+sev@rjrjsai nin.nine-six@hvnsai Explanation Case 1: Let S1="" and S2="" Given number represent 54785949 which is 5.4785949e+7 in scientific notation. By reducing the number after the point (4785949) to a single digit, we get 1 and by reducing power to a single digit we get 7. So, according to given rules, the first string will be fiv.onee+sev. Since 7 is an odd number, we select all the letters at odd place of the name. So S2 will become rjrjsai. So the final password will be fiv.onee+sev@rjrjsai Case 2: Let S1="" and S2="" The scientific notation for the given decimal number is 9.34749e-6. By reducing the number after the point (34749) to a single digit, we get 9 and by reducing power to a single digit we get 6. So, according to given rules, the first string will be nin.nine-six. Since 6 is even number, we select all the letters at even place of the string. So S2 will be hvnsai. So the final password will be nin.nine-six@hvnsai Example 2 Input 2 12.7u3 mahadev 3 dhanyajoselyn Output Invalid thr.zerezer@hnaoey Explanation Case 1: Given input is invalid, hence print "Invalid". Case 2: Obeying the rules, scientific notation of 3 will be 3.0e0. By the given rules S1 will be thr.zerezer and S2 will be hnaoey. Hence the required output is thr.zerezer@hnaoey. java code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started