Complete a Programming Task

Sigchi4life
Category:
Programming
Price: $5 USD

Question description

A word is nice if it contains the same string as a proper prefix as well as a proper suffix. A proper prefix or suffix cannot be a long as the word itself.

e.g.
manama is nice because it contains ma as a proper prefix as well as a proper suffix.
panama is not a nice word.

Find out if a word is nice or not. 

INPUT
The first line of input contains T, the number of test cases. T test cases follow. Each test case contains a single word W

OUTPUT
This should contain T lines, each containing either NICE or NOT

CONSTRAINTS
The length of any word will not exceed 10
Each word will contain only uppercase letters 

SAMPLE INPUT
4
MANAMA
PANAMA
ABCDEFABC
PANDORA 

SAMPLE OUTPUT
NICE
NOT
NICE
NOT

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Boston College
PREMIUM TUTOR
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1824 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors