JOIN
Get Time

   Problem Statement  

 Problem Statement for Palindromize2

Problem Statement

    

A palindrome is a string that reads the same from left to right as it does from right to left. Given a String s, return a palindrome that is produced by changing the minimum possible number of characters in s. Changing a character means replacing it with any single character at the same position. You are not allowed to remove or add any characters. If there are multiple answers, return the one that comes first alphabetically.

 

Definition

    
Class:Palindromize2
Method:minChanges
Parameters:String
Returns:String
Method signature:String minChanges(String s)
(be sure your method is public)
    
 

Constraints

-s will contain between 1 and 50 characters, inclusive.
-Each character of s will be a lowercase letter ('a'-'z').
 

Examples

0)
    
"ameba"
Returns: "abeba"
You can get "abeba" or "amema" with only 1 change. Among those two, "abeba" comes earlier alphabetically.
1)
    
"cigartragic"
Returns: "cigartragic"
The input is already a palindrome, so the best choice is to do 0 changes.
2)
    
"abcdef"
Returns: "abccba"
3)
    
"cxbpaxz"
Returns: "cxapaxc"

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.

This problem was used for:
       Single Round Match 337 Round 1 - Division II, Level One