Question: 1. Write a program that prompts the user to enter a Social Security number as a string in the format DDD-DD-DDDD where D is a
1. Write a program that prompts the user to enter a Social Security number as a string in the format DDD-DD-DDDD where D is a digit from 0 to 9. The rightmost character can be from 0 to 9 as well as A to Z. The program should check whether the input is valid and in the correct format (there's a dash after the first 3 digits and after the second group of 2 digits). If an input is invalid, print the input and the position in the string (starting from position 0). Loop until a valid number is entered. 2. Write a program that asks the user two enter two strings and reports if the second string is a substring of the first. For example, input of ABCD and BC would report that BC is a substring in ABCD and starts at position 1. If the input is ABCD and BDC, the program would report that BCD is not a substring of ABCD. Check that the length of the first string is equal to or greater than the length of the second string. If it isn't, ask the user to input both strings again. The program loops until the input for the first string is of length 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
