/**************************************************
Write a program that reads a list of banned words 
from a file, stores them in an array,  and then 
simply reads words from the user and returns 
"banned" or "not banned" until the word "end" is 
encountered.  The file starts with a number, which 
is the number of banned words, and then the words 
themselves are listed.
**************************************************/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
  // Get name of banned-words file
  string file;
  cout << "Enter name of input file: ";
  cin >> file;

  // Create input file stream
  ifstream FIN(file.begin());
  if (!FIN)
  {
    cout << "File not found!" << endl;
    return 1;
  }

  // Read number of words & allocate array!
  int N;
  FIN >> N;
  string *A = new string[N];

  // Read words from file into array
  for(int i = 0; i < N; i++)
    FIN >> A[i];

  // Get words from user
  string s;
  cout << "Enter list of words terminated by \"end\"" << endl;
  for(cin >> s; s != "end"; cin >> s)
  {
    // Look for s in banned list
    bool found = false;
    for(int j = 0; j < N; j++)
      if (s == A[j])
	found = true;
    
    // Print results
    if (found)
      cout << "Banned!" << endl;
    else
      cout << "Not Banned!" << endl;
  }
  
  return 0;
}