Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions