#include <iostream>
#include <string.h>
using namespace std;
#define MAX_INPUT 20

bool only_lower_alpha(char* str){
  char local[MAX_INPUT];
  bool all_alpha = true;

  strcpy(local, str);
  for(int i = 0; i < MAX_INPUT && local[i] != '\0' && all_alpha; i++){
    all_alpha = local[i] >= 'a' && local[i] <= 'z';
  }

  return all_alpha;
}

char* get_user_input(char* prompt){
  char* user_input = new char[MAX_INPUT];

  do{
    cout << prompt << ": ";
    cin >> user_input;
  }while(! only_lower_alpha(user_input));

  return user_input;
}

int main(int argc, char* argv[]){

  char* username = get_user_input("Enter your username");
  char* password = get_user_input("Enter your password");

  if(strcmp(username, "cssmith") == 0 && strcmp(password, "nimda") == 0){
    cout << "ACCESS GRANTED!" << endl;
  }else{
    cout << "AUTHENTICATION FAILURE" << endl;
  }

  return 1;
}
