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.

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 "1abcdefg". 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
Get step-by-step solutions from verified subject matter experts
