Question
Given a string Str, create a program that performs the following actions: If the first character of Str is a digit, but the last character
Given a string Str, create a program that performs the following actions:\ If the first character of Str is a digit, but the last character is not, print "Yes".\ If the last character of Str is a digit, but the first character is not, print "No".\ Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings while reading the input or while printing, as these contribute to the standard output.\ Constraints:\ i) The length of a
$
tring Str should be greater than 2 .\ ii) Str must either start or end with a digit but not both.\ Input Format:\ A single line of input contains a string Str.\ Output Format:\ A single line of output contains "Yes" or "No".\ Sample Input:\ 1abcdefg\ Sample Output:\ Yes\ Explanation:\ Given a string Str is "1 abcdefg". Here the string starts with the digit 1 and last character is not a digit. Hence it prints "Yes" as an output.
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