Strings for Beginners
Reverse, count, capitalise, compress and validate text: the string skills every interview and project uses.
- Reverse a String Return the characters of a string in reverse order.
- Count the Vowels Count how many vowels (a, e, i, o, u) a string contains, ignoring case.
- Capitalize Each Word Make the first letter of every word upper case.
- Longest Word in a Sentence Find the longest word in a sentence; if there's a tie, return the first one.
- Run-Length Encoding Compress a string by replacing each run of the same character with the character and the run's length.
- Is It a Pangram? Check whether a sentence uses every letter of the alphabet at least once.
- Make an Acronym Build an acronym from the first letter of each word, in upper case.
- Caesar Cipher Shift every letter forward in the alphabet by a fixed amount, wrapping from z back to a.
- Reverse the Words Reverse the order of the words in a sentence.
- First Unique Character Return the index of the first character that appears only once, or -1.
- Roman Numerals to Integer Convert a Roman numeral such as MCMXCIV into an integer.
- Longest Common Prefix Find the longest starting text that every word in a list shares.
- Valid Username Check a username against simple rules: length, allowed characters and a starting letter.