Created
March 15, 2014 13:34
-
-
Save MulticolorWorld/9567338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jp.dip.jimanglaurant; | |
import java.util.Scanner; | |
public class B { | |
public static void main(String[] args) { | |
Scanner scan = new Scanner(System.in); | |
String s = scan.next(); | |
scan.close(); | |
int l = s.length(); | |
int ans = 0; | |
for(int i = 0;i < (l / 2);i++){ | |
StringBuilder name = new StringBuilder(s); | |
if(name.charAt(i) == name.charAt(l - i - 1)){ | |
ans += 25; | |
}else{ | |
name.replace(i, i+1, String.valueOf(name.charAt(l - i - 1))); | |
String namet = new String(name); | |
name.reverse(); | |
if(namet.equals(name.toString())){ | |
ans += 24; | |
}else{ | |
ans += 25; | |
} | |
} | |
} | |
ans = ans*2; | |
if(l % 2 == 1){ | |
StringBuilder sb = new StringBuilder(s); | |
sb.reverse(); | |
if(s.equals(sb.toString())){ | |
ans += 0; | |
}else{ | |
ans += 25; | |
} | |
} | |
System.out.println(ans); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment