A new advanced Operating System, incorporating the latest hi-tech features has been designed by Opera Computer Systems. The task of generating copy protection codes to prevent software piracy has been entrusted to the Security Department.
The Security Department has decided to have codes containing a jumbled combination of alternate uppercase letters of the alphabet starting from A upto K (namely among A,C,E,G,I,K). The code may or not be in the consecutive series of alphabets.
Each code should not exceed 6 characters and there should be no repetition of characters. If it exceeds 6 characters, display an appropriate error message.
Write a program to input a code and its length. At the first instance of an error display "Invalid" stating the appropriate reason. In case of no error, display the message "Valid".
Test your program for the following data and some random data.
INPUT N=4 ABCE OUTPUT Invalid Only alternate letters permitted! INPUT N=4 AcIK OUTPUT Invalid! Only upper case letters permitted! INPUT N=4 AAKE OUTPUT Invalid! Repetition of characters not permitted! INPUT N=7 OUTPUT eRROR! Length of string should not exceed 6 characters! INPUT N=4 AEGIK OUTPUT Invalid! String length not the same as specified! INPUT N=3 ACE OUTPUT Valid! INPUT N=5 GEAIK OUTPUT Valid!
Have something to say? Log in to comment on this post.