Question: Algorithms in C + + : 1 . Objective Your goal is to write a program that determines if a string has all unique lowercase
Algorithms in C:
Objective
Your goal is to write a program that determines if a string has all unique lowercase letters.
Problem
The string will be read as a command line argument to the program. The program will then check if thestring has all lowercase letters. If it does not, the program will display an error message and exit. Otherwise, the program will determine whether or not the string has all unique lowercase characters.
Case : No input arguments
Print usage message.
$ unique
Usage: unique
Case : Too many input arguments
Print usage message.
$ unique too many words
Usage: unique
Case : Bad input
$ unique HI
Error: String must contain only lowercase letters.
Case : Bad input
$ unique
Error: String must contain only lowercase letters.
Case : Unique
$ unique abcdefghijklmnopqrstuvwxyz
All letters are unique.
Case : Duplicates
$ unique longstring
Duplicate letters found.
Hint
When a letter is seen, check if the corresponding bit is equal to If it is the letter has already been seen and must be a duplicate. Otherwise, change the corresponding bit from to
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
