Tous les défis
Facile 0 résolus 0 % de réussite

Palindrome String

Check whether text reads the same forwards and backwards.

Decide whether text is a palindrome, considering only letters and digits and ignoring case.

Implement is_palindrome(text).

Input

text: The text to check (ASCII characters).

Output

Return true for a palindrome, otherwise false.

Contraintes

0 ≤ length ≤ 10,000

Exemples

Exemple 1
Entrée :
text = "Racecar"

Sortie attendue :
expected = True
Entrée :
std::string text = "Racecar";

Sortie attendue :
bool expected = true;
Entrée :
string text = "Racecar";

Sortie attendue :
bool expected = true;

Explication

Lowercased, "racecar" reads the same both ways.

Exemple 2
Entrée :
text = "hello"

Sortie attendue :
expected = False
Entrée :
std::string text = "hello";

Sortie attendue :
bool expected = false;
Entrée :
string text = "hello";

Sortie attendue :
bool expected = false;

Explication

"hello" backwards is "olleh", which is different.

Références

Ce défi a été adapté pour CodeUtility. Suivez l'énoncé et les contraintes ci-dessus.

Apprenez des autres

Solutions de la communauté

Aucune solution publiée pour l'instant. Résolvez ce défi pour partager la première.