Palindromes with stacks P65072


Statement
 

pdf   zip

html

Use stacks to tell, for every given sequence of numbers, if the sequence is a palindrome or not. That is, you must tell if the sequence reads the same from left to right than from right to left (without reversing the digits of each number).

Input

Input consists of several sequences of numbers, one per line.

Output

For every line, print “It is a palindrome.” or “It is NOT palindrome.” as required.

Observation

To solve this exercise, the only containers that you should use are stacks of integer numbers.

Public test cases
  • Input

    1 2 3 4 4 3 2 1
    11 22 33 11 22 33
    
    27 21 27 21 27 21 27
    

    Output

    It is a palindrome.
    It is NOT a palindrome.
    It is a palindrome.
    It is a palindrome.
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++