Compute and generate a compressed string for a given string containing repetitions

For a given string return a compressed string which replaces all the repetitions of the characters with their counts. If the compressed string is not smaller than the initial string return the original string as it is. For example, if the input string is "aabbbbbcccdddeef", then the resultant string should be "a2b5c3d3e2f1", whereas if the input string is "abcdef" then the output should be "abcdef".

Check if a given string is Palindrome

A Palindrome is defined as a phrase or a number which when reversed also gives the same phrase or number. For example, the word abcdcba is a palindrome because even when you read the string from end to the beginning you'll get the same string as the original. Some real words such as malayalam, madam, refer, reviver, noon, mom and such are all palindromes in general use.