SA-MP Forums Archive
NEED HELP ASAP with C Lang - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: NEED HELP ASAP with C Lang (/showthread.php?tid=522260)



NEED HELP ASAP with C Lang - TrinityGamingRoleplay - 26.06.2014

A palindrome is a string which reads the same forward and backwards. You are provided a function shortPalin which accepts a string S.
You are required to form a palindrome by adding 0 or more characters to the string at any location which you find appropriate. Return the minimum number of characters which needs to be added to the string to transform it into a palindrome. The section of the program which parses the input and displays the output will be handled by us. Your task is to complete the body of the function or method provided, and to return the correct output.

Sample input #00:
String(S):abab

Sample output #00:
1

Explanation:
A palindrome can be obtained by simply adding an 'a' to the string to form 'ababa'.

Sample input #01:
String(S): abacaba