pyPython Practice LabFrom first print to final round
TOPIC 04 OF 18

String Processing Python practice problems

Learn normalization, slicing, counting, searching, and transformation of real text.

20 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL PRACTISE

Core concepts

Reverse textCheck a phrase palindromeCount vowels and consonantsCount wordsCount a chosen characterRemove duplicate charactersCheck for anagramsFind the first nonrepeating character
REUSABLE THINKING

Problem-solving patterns

  • Normalize text → scan or transform → return
INTERVIEW SIGNALS

Reported company tags

AmazonMicrosoftTCS
Community-reported tags are guidance, not guarantees.
ORDERED PRACTICE

All 20 problems in this topic

Work from top to bottom to build the concept gradually.

  1. #061
    Reverse text: Reverse a label

    Reverse a short product label for a string-slicing exercise.

    BeginnerPremium
  2. #062
    Reverse text: Keep spaces

    Reverse every character, including the space between two words.

    BeginnerPremium
  3. #063
    Check a phrase palindrome: Classic phrase

    Check a phrase that is a palindrome when spaces and case are ignored.

    BeginnerPremium
  4. #064
    Check a phrase palindrome: Punctuation and case

    Check a sentence containing punctuation and mixed capitalization.

    BeginnerPremium
  5. #065
    Count vowels and consonants: Course name

    Count the letter types in a short course title.

    BeginnerPremium
  6. #066
    Count vowels and consonants: Ignore digits and punctuation

    Ensure numbers and punctuation are not counted as consonants.

    BeginnerPremium
  7. #067
    Count words: Short sentence

    Count words in a normal sentence.

    BeginnerPremium
  8. #068
    Count words: Extra spacing

    Count correctly even when the user enters several spaces between words.

    BeginnerPremium
  9. #069
    Count a chosen character: Count a letter

    Count how often a letter appears in a fruit name.

    BeginnerPremium
  10. #070
    Count a chosen character: Case-sensitive count

    Observe that uppercase and lowercase characters are different.

    BeginnerPremium
  11. #071
    Remove duplicate characters: Compress repeated letters

    Keep only the first appearance of each character in a word.

    BeginnerPremium
  12. #072
    Remove duplicate characters: Spaces are characters

    Preserve the first space while removing later repeated characters.

    BeginnerPremium
  13. #073
    Check for anagrams: Simple anagram

    Check two short words made from the same letters.

    BeginnerPremium
  14. #074
    Check for anagrams: Phrase anagram

    Ignore spaces and case when comparing two phrases.

    BeginnerPremium
  15. #075
    Find the first nonrepeating character: Unique letter exists

    Find the earliest character that appears only once.

    BeginnerPremium
  16. #076
    Find the first nonrepeating character: No unique letter

    Return None when every character repeats.

    BeginnerPremium
  17. #077
    Run-length encode text: Repeated groups

    Encode a compact sensor status string with repeated runs.

    BeginnerPremium
  18. #078
    Run-length encode text: No repeated neighbors

    Encode a string where every run has length one.

    BeginnerPremium
  19. #079
    Find the longest word: Course description

    Find the longest word in a brief course description.

    BeginnerPremium
  20. #080
    Find the longest word: Tie behavior

    When two words tie, return the first one encountered.

    BeginnerPremium