Happy Number

5

1 votes
Easy
Problem

Abhi want to see his friend Isis happy.

Isis likes two things about any number(that she calls it a Happy Number).If a number satisfies both the given condition, it is a happy number.

     1.It should be a palindrome

     2.It gives remainder 1 on dividing it by 3 .

So Abhi has a number he wants to give it Isis. 

So help him in selecting a Happy number  

You will be given a number N if the number is happy number print " Happy Number " else print "Sad Number " without the quotation marks. 

INPUTFORMAT:

You will be given a number N

OUTPUT FORMAT:

If the number is happy number Print " Happy Number " else Print "Sad Number ". 

CONSTRAINTS

1<N<105

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

Self Explainatory

Editor Image

?