Competitive Programming Solutions

GitHub
back to dashboard

I. Palindrome

Codeforces - Sheet #2 (Loops) · limit: 1s · memory: 256MB · view on codeforces

input

12121

output

12121
YES
Main.java
static void solve() {

        // Write your solution here\
        String s = in.next();
        int n = Integer.parseInt(s);
        String sRev = new StringBuilder(s).reverse().toString();
        int nRev = Integer.parseInt(sRev);
        out.println(nRev);
        out.println( n == nRev ? "YES" : "NO");

    }