Submission #143665


Source Code Expand

Copy
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();

		int differentCount = 0;
		int size = s.length();
		int res = 1;
		int mid = size>>1;
		for(int i=0;i<mid;i++){
			if(s.charAt(i) != s.charAt(size-i-1)){
				differentCount++;
				if(differentCount>=2)
					break;
			}
		}
		
		if(differentCount>=2){
			res = size * 25;
		}else if(differentCount == 1){
			res = 24*2 + 25*(size-2); 
		}else{
			res = 25*(size>>1)*2;
		}
		System.out.println(res);
		
	}
}

Submission Info

Submission Time
Task B - こだわりの名前
User scache
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 588 Byte
Status
Exec Time 570 ms
Memory 28940 KB

Test Cases

Set Name Score / Max Score Test Cases
All 100 / 100 hand_1.txt, hand_2.txt, hand_3.txt, hand_4.txt, hand_5.txt, hand_6.txt, palindrome_1.txt, palindrome_12345.txt, palindrome_2.txt, palindrome_299998.txt, palindrome_299999.txt, palindrome_3.txt, palindrome_300000.txt, palindrome_4.txt, palindrome_5.txt, palindrome_6789.txt, palindrome_67890.txt, palindrome_mod_1.txt, palindrome_mod_1000.txt, palindrome_mod_10000.txt, palindrome_mod_100001.txt, palindrome_mod_2.txt, palindrome_mod_200000.txt, palindrome_mod_299999.txt, palindrome_mod_3.txt, palindrome_mod_300000.txt, palindrome_mod_4.txt, palindrome_mod_5.txt, palindrome_mod_50001.txt, random_1.txt, random_10.txt, random_100001.txt, random_101.txt, random_3000.txt, random_300000.txt, random_50001.txt
Case Name Status Exec Time Memory
hand_1.txt 550 ms 28020 KB
hand_2.txt 522 ms 28264 KB
hand_3.txt 520 ms 28380 KB
hand_4.txt 544 ms 28408 KB
hand_5.txt 531 ms 28392 KB
hand_6.txt 516 ms 28696 KB
palindrome_1.txt 431 ms 22968 KB
palindrome_12345.txt 487 ms 24684 KB
palindrome_2.txt 429 ms 23216 KB
palindrome_299998.txt 534 ms 28536 KB
palindrome_299999.txt 519 ms 28740 KB
palindrome_3.txt 430 ms 23216 KB
palindrome_300000.txt 531 ms 28280 KB
palindrome_4.txt 429 ms 23092 KB
palindrome_5.txt 431 ms 23096 KB
palindrome_6789.txt 469 ms 24360 KB
palindrome_67890.txt 519 ms 25776 KB
palindrome_mod_1.txt 439 ms 23080 KB
palindrome_mod_1000.txt 441 ms 23188 KB
palindrome_mod_10000.txt 524 ms 25452 KB
palindrome_mod_100001.txt 518 ms 25540 KB
palindrome_mod_2.txt 446 ms 23088 KB
palindrome_mod_200000.txt 526 ms 26812 KB
palindrome_mod_299999.txt 531 ms 28400 KB
palindrome_mod_3.txt 430 ms 23096 KB
palindrome_mod_300000.txt 570 ms 28940 KB
palindrome_mod_4.txt 428 ms 23088 KB
palindrome_mod_5.txt 431 ms 22964 KB
palindrome_mod_50001.txt 521 ms 25128 KB
random_1.txt 430 ms 23148 KB
random_10.txt 430 ms 23092 KB
random_100001.txt 503 ms 25832 KB
random_101.txt 432 ms 23088 KB
random_3000.txt 453 ms 23092 KB
random_300000.txt 527 ms 28608 KB
random_50001.txt 502 ms 25200 KB
sample_1.txt 429 ms 23092 KB
sample_2.txt 432 ms 23084 KB
sample_3.txt 428 ms 23004 KB