biryu2205 / Biryu

0 stars 0 forks source link

Hackerrank String Reverse #82

Closed biryu2205 closed 6 years ago

biryu2205 commented 7 years ago
import java.util.Scanner;

class Solution {
  static String reverse(String s) {
    return new StringBuffer(s).reverse().toString();
  }

  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    String a = cin.next();
    System.out.println(a.equals(reverse(a)) ? "Yes" : "No");
  }
}

Link - https://www.hackerrank.com/challenges/java-string-reverse/problem