#include <iostream>
#include <cassert>
#include <cstring>
#include <cmath>
std::string find_happy(int x) {
int sum = 0;
//Find the amount of digit of the current number.
int digit = int(log10(x) + 1);
for(int i=0;i<digit;i++) {
int d = x%10;
x/=10;
sum+=std::pow(d,2);
}
return (sum==4) ? "It's not happy number." : (sum==1) ? "It's happy number." : find_happy(sum);
}
int main(int argc, char* argv[]) {
std::cout << "Enter a number greater than zero: ";
int idx; std::cin>>idx;
assert(idx>0);
std::cout << find_happy(idx) << std::endl;
return 0;
}