Explanation

514.Read a Number Typed as Text

Easy
Given the characters a user typed, text, return the number they represent multiplied by 2. Whatever a user types — on a keyboard or into a test file — reaches the program as textStandard InputThe stream a program reads typed input from. It always delivers characters, never numbers.. Java reads it with Scanner or BufferedReader.readLine(), Python with input(), C++ with cin or getline, C with scanf or fgets, and JavaScript with a line reader. Even when the user types 21, a line-based read hands back the two characters '2' and '1', not the number twenty-one. (Helpers like nextInt() or cin >> n look like they read numbers, but they do this same conversion internally.) On this site the reading is done for you and the text arrives as the text parameter; your job is the next step every input-handling program needs — turning that text into a number you can do arithmetic with. Doubling the result proves the conversion worked: done wrong, "21" becomes "2121" instead of 42.

Example 1:

Input: text = "21"

Output: 42

Example 2:

Input: text = "007"

Output: 14

+ 5 hidden test cases run on Submit.

Constraints:

  • ●1 ≤ text.length ≤ 9
  • ●text contains only the digits 0-9
  • ●0 ≤ the number in text ≤ 100000000

text =

21