Tutte le sfide
Facile 0 risolte 0% di accettazione

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.

Vincoli

0 ≤ length ≤ 10,000

Esempi

Esempio 1
Input:
text = "Racecar"

Output atteso:
expected = True
Input:
std::string text = "Racecar";

Output atteso:
bool expected = true;
Input:
string text = "Racecar";

Output atteso:
bool expected = true;

Spiegazione

Lowercased, "racecar" reads the same both ways.

Esempio 2
Input:
text = "hello"

Output atteso:
expected = False
Input:
std::string text = "hello";

Output atteso:
bool expected = false;
Input:
string text = "hello";

Output atteso:
bool expected = false;

Spiegazione

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

Riferimenti

Questa sfida è adattata per CodeUtility. Segui la traccia e i vincoli sopra.

Impara dagli altri

Soluzioni della community

Nessuna soluzione pubblicata. Risolvi questa sfida per condividere la prima.