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++:
1. Objective
Your goal is to write a program that determines if a string has all unique lowercase letters.
2. 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 1: No input arguments
Print usage message.
$ ./unique
Usage: ./unique
Case 2: Too many input arguments
Print usage message.
$ ./unique too many words
Usage: ./unique
Case 3: Bad input
$ ./unique HI
Error: String must contain only lowercase letters.
Case 4: Bad input
$ ./unique 1234567890
Error: String must contain only lowercase letters.
Case 5: Unique
$ ./unique abcdefghijklmnopqrstuvwxyz
All letters are unique.
Case 6: Duplicates
$ ./unique longstring
Duplicate letters found.
3. Hint
When a letter is seen, check if the corresponding bit is equal to 1. If it is, the letter has already been seen and must be a duplicate. Otherwise, change the corresponding bit from 0 to 1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!