157 Days Of Code — 01–13/05/2016

Aayush Bhardwaj
Let’s GOOGLE it !
1 min readMay 13, 2016

Days Completed — 0

Days Left — 157

Challenge 01 :

Objective
Today, we’re getting started with Exceptions by learning how to parse an integer from a string and print a custom error message.

Task
Read a string, S, and print its integer value; if S cannot be converted to an integer, print “Bad String”.

Note: You must use the String-to-Integer and exception handling constructs built into your submission language. If you attempt to use loops/conditional statements, you will get a 0 score.

Input Format

A single string, .

Constraints

  • 1<= |S| < =6, where |S|is the length of string .
  • S is composed of either lowercase letters (a-z) or decimal digits (0–9).

Output Format

Print the parsed integer value of S, or “Bad String” if S cannot be converted to an integer.

Source : Hackerrank

SOLUTION :

The question is open till tonight 11:59 pm , comment below the github link of your answer .

--

--