std::cin >> userWord;
if (checkPalindrome(userWord)) {
std::cout << "The input word is a palindrome." << std::endl;
} else {
std::cout << "The input word is not a palindrome." << std::endl;
}
return 0;
}
#Day3#Bowentechweek#Hackathon
Writing a program to check if a string is a palindrome C
#include <iostream>
#include <string>
bool checkPalindrome(const std::string& word) {
int left = 0;
int right = word.length() - 1;
while (left < right) {
hace unas semanas vi a @CarGDev enseñando su solución sobre los palindromos, & I want to share:
function checkPalindrome(inputString) {
const palindrome = inputString.split("").reverse().join("");
if (inputString === palindrome) {
return true
} {
return false
}
}