LCC/Moose '19 Contest 2 J3 - Simple Sentences

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Grading MaCS entrance exams has become more and more difficult as more students apply.

Can you make a program that makes sure every sentence is valid before passing it on to the judges?

A valid sentence consists of the following:

 1. Starts with a capital letter.
 2. Ends with a *single* punctuation mark (!.?), the only punctuation mark in the sentence.
 3. Contains more than 2 words separated by spaces (ex. "I love sentences.").
 4. No word is longer than 34 characters.
 5. Contains at least one of the following words ('I', 'he', 'she', 'they', 'it', 'this'), with any capitalization.

A word is any group of 1 or more letters.

Input Specification

The first line will contain a string S (0 \le |S| \le 10^3) to be tested for validity.

The sentence will only contain lowercase and uppercase letters, along with the characters . !?. The symbols ,:;' will not appear.

No consecutive spaces will appear.

Output Specification

On the first line, output HOTLINE if the sentence is valid and REJECT if the sentence is not.

Sample Input 1

This is a long winded sentence.

Sample Output 1

HOTLINE

Sample Input 2

Who is this? This is joe.

Sample Output 2

REJECT

Sample 2 Explanation

While each of these sentences, if separated by spaces, are correct by themselves, we are to assume that this is a single sentence, thus breaking rule #2 with multiple punctuation marks.


Comments

There are no comments at the moment.