/**
 * Given a string, write a function to count the number of palindromes present in it.
 *
 * Palindrome: A word, phrase, number, or other sequence of characters which reads the same backward as forward.
 *
 * @param string A string of characters.
 * @return An integer representing the number of palindromes in the given string.
 */
fun countPalindrome(string: String): Int {

    var count = 0  // Initializing the count of palindromes to zero

    // Slicing the string into substrings and checking if each substring is a palindrome
    var i = 0
    while (i < string.length) {
        var j = i + 1
        while (j <= string.length) {
            // Checking if the substring is a palindrome
            if (string.substring(i, j) == string.substring(i, j).reversed()) {
                count++
            }
            j++
        }
        i++
    }

    return count
}
/**
 * Given a string, write a function to count the number of palindromes present in it.
 *
 * Palindrome: A word, phrase, number, or other sequence of characters which reads the same backward as forward.
 *
 * @param string A string of characters.
 * @return An integer representing the number of palindromes in the given string.
 */
fun countPalindrome(string: String): Int {
/**
 * Given a string, write a function to count the number of palindromes present in it.
 *
 * Palindrome: A word, phrase, number, or other sequence of characters which reads the same backward as forward.
 *
 * @param string A string of characters.
 * @return An integer representing the number of palindromes in the given string.
 */
fun countPalindrome(string: String): Int {

    var count = 0  // Initializing the count of palindromes to zero

    // Slicing the string into substrings and checking if each substring is a palindrome
    var i = 0
    while (i < string.length) {
        var j = i + 1
        while (j <= string.length) {
            // Checking if the substring is a palindrome
            if (string.substring(i, j) == string.substring(i, j).reversed()) {
                count++
            }
            j++
        }
        i++
    }

    return count
}