Problem:
Score : 200 points

Problem Statement

You are given a positive integer X.
Find the largest perfect power that is at most X.
Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.

Constraints

1 ≤ X ≤ 1000

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

Print the largest perfect power that is at most X.

Sample Input 1

10

Sample Output 1

9

There are four perfect powers that are at most 10: 1, 4, 8 and 9.
We should print the largest among them, 9.

Sample Input 2

1

Sample Output 2

1

Sample Input 3

999

Sample Output 3

961

Solution in C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<stdio.h>
int main(){
    int X;
    
    scanf("%d",&X);
    
    
    if (X<4) {
        printf("1\n");
    }else if (X<8){
        printf("4\n");
    }else if (X<9){
        printf("8\n");
    }else if (X<16){
        printf("9\n");
    }else if (X<25){
        printf("16\n");
    }else if (X<27){
        printf("25\n");
    }else if (X<32){
        printf("27\n");
    }else if (X<36){
        printf("32\n");
    }else if (X<49){
        printf("36\n");
    }else if (X<64){
        printf("49\n");
    }else if (X<81){
        printf("64\n");
    }else if (X<100){
        printf("81\n");
    }else if (X<121){
        printf("100\n");
    }else if (X<125){
        printf("121\n");
    }else if (X<128){
        printf("125\n");
    }else if (X<144){
        printf("128\n");
    }else if (X<169){
        printf("144\n");
    }else if (X<196){
        printf("169\n");
    }else if (X<216){
        printf("196\n");
    }else if (X<225){
        printf("216\n");
    }else if (X<243){
        printf("225\n");
    }else if (X<256){
        printf("243\n");
    }else if (X<289){
        printf("256\n");
    }else if (X<324){
        printf("289\n");
    }else if (X<361){
        printf("324\n");
    }else if (X<400){
        printf("361\n");
    }else if (X<441){
        printf("400\n");
    }else if (X<484){
        printf("441\n");
    }else if (X<512){
        printf("484\n");
    }else if (X<529){
        printf("512\n");
    }else if (X<576){
        printf("529\n");
    }else if (X<625){
        printf("576\n");
    }else if (X<676){
        printf("625\n");
    }else if (X<729){
        printf("676\n");
    }else if (X<784){
        printf("729\n");
    }else if (X<841){
        printf("784\n");
    }else if (X<900){
        printf("841\n");
    }else if (X<961){
        printf("900\n");
    }else if (X<1000){
        printf("961\n");
    }
    
    
    return 0;
    
}