String Processing Python practice problems
Learn normalization, slicing, counting, searching, and transformation of real text.
Core concepts
Problem-solving patterns
- Normalize text → scan or transform → return
Reported company tags
All 20 problems in this topic
Work from top to bottom to build the concept gradually.
- #061Reverse text: Reverse a labelBeginnerPremium
Reverse a short product label for a string-slicing exercise.
- #062Reverse text: Keep spacesBeginnerPremium
Reverse every character, including the space between two words.
- #063Check a phrase palindrome: Classic phraseBeginnerPremium
Check a phrase that is a palindrome when spaces and case are ignored.
- #064Check a phrase palindrome: Punctuation and caseBeginnerPremium
Check a sentence containing punctuation and mixed capitalization.
- #065Count vowels and consonants: Course nameBeginnerPremium
Count the letter types in a short course title.
- #066Count vowels and consonants: Ignore digits and punctuationBeginnerPremium
Ensure numbers and punctuation are not counted as consonants.
- #067Count words: Short sentenceBeginnerPremium
Count words in a normal sentence.
- #068Count words: Extra spacingBeginnerPremium
Count correctly even when the user enters several spaces between words.
- #069Count a chosen character: Count a letterBeginnerPremium
Count how often a letter appears in a fruit name.
- #070Count a chosen character: Case-sensitive countBeginnerPremium
Observe that uppercase and lowercase characters are different.
- #071Remove duplicate characters: Compress repeated lettersBeginnerPremium
Keep only the first appearance of each character in a word.
- #072Remove duplicate characters: Spaces are charactersBeginnerPremium
Preserve the first space while removing later repeated characters.
- #073Check for anagrams: Simple anagramBeginnerPremium
Check two short words made from the same letters.
- #074Check for anagrams: Phrase anagramBeginnerPremium
Ignore spaces and case when comparing two phrases.
- #075Find the first nonrepeating character: Unique letter existsBeginnerPremium
Find the earliest character that appears only once.
- #076Find the first nonrepeating character: No unique letterBeginnerPremium
Return None when every character repeats.
- #077Run-length encode text: Repeated groupsBeginnerPremium
Encode a compact sensor status string with repeated runs.
- #078Run-length encode text: No repeated neighborsBeginnerPremium
Encode a string where every run has length one.
- #079Find the longest word: Course descriptionBeginnerPremium
Find the longest word in a brief course description.
- #080Find the longest word: Tie behaviorBeginnerPremium
When two words tie, return the first one encountered.