$29
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 the string 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 <string>
Case 2: Too many input arguments
Print usage message.
$ ./unique too many words
Usage: ./unique <string>
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.