Curated sets

Strings and text

Parsing, matching, and tries.

All problems
Total results1,816 problems
TopicsJudge
Hash collision stringsPrint two length-N strings that differ but have equal Java String hashCode values, using the classic Aa/BB collision with a shared prefix.Easy2StringHash map+2No attempts yet2s512 MBJudgeable
Binary GamePrint the binary representations of 0 through n, concatenated with no separators.Easy2StringImplementationNo attempts yet1s256 MBJudgeable
RickRead one line and print NO if it exactly matches one of six given phrases, otherwise print YES.Easy2StringImplementationNo attempts yet1s256 MBJudgeable
Derivative of a polynomial functionParse a linear polynomial written like 3x+5 or -x+2 and print the constant that is its derivative.Easy2StringImplementation+1No attempts yet1s512 MBJudgeable
Master of the Shell GameGiven a string, perform T swaps of characters at the given 0-indexed positions in order and print the final string.Easy2StringSimulation+1No attempts yet1s128 MBJudgeable
What Is Your HandleSort N distinct handles by ASCII dictionary order and print the I-th one.Easy2SortingString+1No attempts yet1s512 MBJudgeable
Caesar CipherShift every letter of a string by k positions in the alphabet, wrapping around, and leave spaces, periods, and commas unchanged.Easy2StringImplementation+1No attempts yet1s64 MBJudgeable
What Does UCPC Stand For?Given one string, decide whether deleting some characters can leave exactly the subsequence UCPC, case sensitive.Easy2StringGreedy+1No attempts yet1s512 MBJudgeable
Minimum String DifferenceSlide the shorter string A across every possible alignment position over B and output the minimum number of mismatched characters.Easy3StringSliding window+1No attempts yet2s128 MBJudgeable
Strange MultiplicationGiven two large numbers as digit strings, compute the sum of all pairwise products of their digits, which equals the product of their digit sums.Easy3MathString+1No attempts yet2s256 MBJudgeable
Student NumbersGiven N equal-length numeric strings, find the smallest suffix length k so that all suffixes of length k remain distinct.Easy3StringBrute force+1No attempts yet2s128 MBJudgeable
Binary AdditionAdd two binary strings up to 80 digits long and print the sum in binary without leading zeros.Easy3StringMath+1No attempts yet2s128 MBJudgeable
Make a PalindromeGiven a lowercase string of length at most 50, find the minimum length of a palindrome obtained by appending characters only to its end.Easy3StringBrute force+1No attempts yet2s128 MBJudgeable
Shortcut Key AssignmentAssign each menu option an unused shortcut letter by checking word-initial letters first, then any letter in the string, following the options in order.Easy3SimulationString+1No attempts yet2s128 MBJudgeable
Binary to Octal ConversionConvert a binary number with up to 1,000,000 digits into its octal representation.Easy3Bit manipulationMath+2No attempts yet1s128 MBJudgeable
MessagesGiven sheets of names passed around a circle with P/N marks, find who wrote each hurtful (N) message and about whom.Easy3SimulationArray+2No attempts yet1s128 MBJudgeable
Serial NumbersSort serial numbers by length, then digit-sum, then a custom lexicographic rule where digits precede letters.Easy3SortingString+1No attempts yet2s128 MBJudgeable
Lost ParenthesesGiven an arithmetic expression with only plus and minus signs, place parentheses to minimize the evaluated result.Easy3GreedyString+1No attempts yet2s128 MBJudgeable
Cyclic WordsCount how many words are distinct once each is allowed to be read starting from any position around a circle.Easy3StringBrute force+1No attempts yet2s128 MBJudgeable
I Am Pokemon Master DasomBuild a bidirectional mapping between Pokemon numbers and names, then answer up to 100,000 lookup queries either way.Easy3Hash mapImplementation+1No attempts yet2s256 MBJudgeable
Common PermutationFor each pair of input strings, count letter frequencies and output the multiset intersection sorted alphabetically as the longest common rearranged subsequence.Easy3Hash mapString+1No attempts yet2s128 MBJudgeable
Lucky TicketFind the longest even-length substring of a digit string whose first half digit sum equals its second half digit sum.Easy3Prefix sumBrute force+2No attempts yet2s128 MBJudgeable
DNA DecodingRepeatedly merge the last two bases of a DNA string using a fixed lookup table until one base remains, then output it.Easy3SimulationString+1No attempts yet5s16 MBJudgeable
CrosswordGiven a filled crossword grid, extract every maximal horizontal or vertical run of letters of length at least two and output the lexicographically smallest such word.Easy3StringImplementation+1No attempts yet2s128 MBJudgeable
CipherEncrypt a lowercase text by shifting each letter backward in the alphabet by the position value of a repeating key letter, leaving spaces unchanged but still consuming a key character.Easy3StringSimulation+1No attempts yet2s256 MBJudgeable
Number Word SortSort integers from M to N by comparing their digits spelled out as English words rather than by numeric value, then print 10 per line.Easy3SortingString+1No attempts yet2s128 MBJudgeable
Password GenerationGenerate all length-L increasing letter combinations from a given set of C letters that contain at least one vowel and two consonants, printed in lexicographic order.Easy3BacktrackingBrute force+1No attempts yet2s128 MBJudgeable
Common NamesGiven two lists of unique lowercase names, find and print the count and sorted list of names common to both.Easy3Hash mapSorting+1No attempts yet2s256 MBJudgeable
Multiple of ThreeGiven a huge number as a digit string, repeatedly sum its digits until one digit remains, then report how many steps it took and whether the number is divisible by 3.Easy3StringMath+1No attempts yet2s128 MBJudgeable
CipherGiven an encrypted string built by zigzag row reading of a column-filled table, reconstruct the original string for a given number of columns.Easy3SimulationMatrix+2No attempts yet2s128 MBJudgeable
Broken OdometerConvert an odometer reading that skips the digit 4 back into the real distance traveled, using a base-9-like digit mapping.Easy3MathImplementation+1No attempts yet0.5s128 MBJudgeable
Carbon CompoundsParse three molecules of C,H,O atoms and find coefficients 1 to 10 for each side that balance atom counts, lexicographically smallest.Easy3Brute forceString+1No attempts yet2s128 MBJudgeable
Postfix Expression Evaluation 2Evaluate a postfix expression using given operand values and print the result rounded to two decimal places.Easy3StackString+1No attempts yet2s128 MBJudgeable
DNAGiven N DNA strings of length M, construct the string minimizing total Hamming distance to all, breaking ties lexicographically, and output that distance.Easy3StringGreedy+1No attempts yet2s128 MBJudgeable
Surprising StringFor each string, check for every gap size whether all pairs of letters at that fixed distance are distinct, and report if the string is 'surprising'.Easy3StringBrute force+1No attempts yet2s128 MBJudgeable
OvertakingGiven entry and exit orders of N cars, count how many cars are not part of the longest common subsequence, meaning they overtook someone.Easy3Dynamic programmingArray+1No attempts yet2s128 MBJudgeable
Text MessageSimulate typing a message on a numeric keypad, summing key press costs and extra wait times when consecutive characters share a key (except spaces).Easy3SimulationString+1No attempts yet2s128 MBJudgeable
DNA Decoding 2Given a DNA string up to 20 million bases, repeatedly collapse the rightmost two characters using a lookup table until one base remains.Easy3StringSimulation+1No attempts yet1s2 MBJudgeable
Distinguishing FilesGiven N files as sequences padded with zeros, find the minimum prefix length K that makes all files pairwise distinct.Easy3StringBrute force+1No attempts yet2s128 MBJudgeable
SaschaGiven a pronounced word and a dictionary of same-length words, find the dictionary word with the minimum Hamming distance, breaking ties by input order.Easy3StringBrute force+1No attempts yet2s128 MBJudgeable
Secret LetterDecode a binary string into 6-bit chunks matching a fixed 8-letter code table by Hamming distance at most 1, printing the first unidentifiable chunk's position if any.Easy3StringBrute force+1No attempts yet1s128 MBJudgeable
Similar WordsCount how many words differ from the first word's letter multiset by at most one insertion, deletion, or substitution.Easy3Hash mapString+1No attempts yet1s128 MBJudgeable
Roman NumeralsConvert two Roman numerals to integers, sum them, and output the sum as both an Arabic and a Roman numeral.Easy3StringMath+1No attempts yet1s128 MBJudgeable
Spreadsheet Cell NamesConvert given row and column numbers into spreadsheet-style cell names like A1 or BC23, stopping at R0C0.Easy3MathString+1No attempts yet1s128 MBJudgeable
Window BlindsParse a grid of ASCII-drawn window blinds and count how many of the M×N windows show each of five possible blind heights.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
Make a CrosswordBuild a grid where word A is placed horizontally and word B vertically, crossing at the first shared letter following a defined scan rule, filling the rest with dots.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Math HomeworkExtract every maximal run of digits from up to 100 strings, strip leading zeros, and print all extracted numbers sorted nondecreasing.Easy3StringSorting+1No attempts yet1s128 MBJudgeable
Machine CodeGiven a sequence of instructions with parameters, compute the minimum NOPs needed so each instruction starts at an address divisible by 4.Easy3GreedySimulation+1No attempts yet1s128 MBJudgeable
Rock-Paper-Scissors ScoreGiven a player's rock-paper-scissors choices against several friends over multiple rounds, compute the actual score and the best possible score with foreknowledge each round.Easy3SimulationGreedy+1No attempts yet1s128 MBJudgeable
NoiseGiven two powers of ten with up to 100 digits and an operator, compute their sum or product using big-number arithmetic.Easy3MathString+1No attempts yet1s128 MBJudgeable
Croatian AlphabetParse a string left to right, greedily matching multi-character Croatian letter codes (like c=, dz=, lj), and count total letters.Easy3StringGreedy+1No attempts yet1s128 MBJudgeable
Three PartsSplit a short lowercase string into three contiguous non-empty parts, reverse each part, and find the split that yields the lexicographically smallest concatenation.Easy3Brute forceString+1No attempts yet1s128 MBJudgeable
Secret EmailGiven an encrypted string, find matrix dimensions R<=C with R*C=N and largest R, then reverse a row-major-write column-major-read transposition to recover the original message.Easy3MatrixString+1No attempts yet1s128 MBJudgeable
Lexicographically Smallest Crossword WordExtract all horizontal and vertical maximal letter sequences of length at least 2 from a grid and output the lexicographically smallest one.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
IPv6Given a shortened IPv6 address with omitted leading zeros and possibly one '::' run, expand it into eight full 4-digit hex groups.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
Rhyme PatternGiven verses of four lines, extract each line's last syllable from its final word and classify the rhyme pattern as perfect, even, cross, shell, or free.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
Most Visited DomainsParse a list of URLs to extract each domain suffix and print the maximum visit count along with all domains that reach it, sorted alphabetically.Easy3StringHash map+1No attempts yet1s128 MBJudgeable
DECODEBuild a substitution cipher table from a key word placed at a given offset, then decode a given ciphertext using it.Easy3StringSimulation+1No attempts yet1s128 MBJudgeable
Reaux! Sham! Beaux!Parse rock-paper-scissors rounds given in multiple languages per player, tally wins, and print each game's score and winner.Easy3StringHash map+1No attempts yet1s128 MBJudgeable
Bug KingRepeatedly remove all occurrences of the substring "BUG" from each input line, using a stack-like scan since removals can form new matches, until none remain.Easy3StackStringNo attempts yet1s128 MBJudgeable
Character RecognitionRead multi-line text blocks separated by blank lines, count '#' as unrecognized characters, and print the recognition percentage formatted with rounding rules.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
Adding Reversed NumbersReverse two given numbers, add them, then output the sum reversed with leading zeros dropped.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Turing Arithmetic ExpressionsGiven up to nine large integers and an arithmetic expression using them, evaluate the expression under mod-10 addition and multiplication with normal precedence and print the result digit.Easy3MathString+1No attempts yet1s128 MBJudgeable
Whitespace King: Aligning ColumnsReformat text lines so that words in each column line up to a width equal to the longest word in that column, with single spaces separating columns.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Alien Communication MasterclassGiven true bases and false bases, output a fixed-form product-of-factors equation that holds only for the true bases in that numeral system.Easy3MathImplementation+1No attempts yet3s256 MBJudgeable
Java vs C++Detect whether a name follows Java camelCase or C++ snake_case rules and convert it to the other style, or print an error if invalid.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
Unreliable MessengersGiven a sequence of reversible string transformations and the final message, undo each transformation in reverse order to recover the original message.Easy3StringSimulation+1No attempts yet1s128 MBJudgeable
Remainder CalculationFor each test case, find the remainder when a base-B number D with up to ten million digits is divided by B-1.Easy3MathNumber theory+2No attempts yet1s256 MBJudgeable
My Brother's DiaryFind the Caesar shift whose most frequent ciphertext letter maps to E, print the smallest valid shift and the decrypted text, or NOT POSSIBLE if several shifts work.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
CIVIC DILL MIXRead groups of valid Roman numerals, add each group, and print the sum and case number back in standard Roman form.Easy3StringMath+1No attempts yet1s128 MBJudgeable
WordsRead lines until a line with a single #, and output each line with the characters of every word reversed, keeping spaces fixed.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
Memorable Phone NumbersNormalize each listed phone number to seven digits and report those appearing more than once, sorted, with their counts.Easy3StringHash map+2No attempts yet1s128 MBJudgeable
Alien Base ConversionConvert a number written in base x into the same value written in base y, where both bases are between 2 and 36 and the value fits in four billion.Easy3MathImplementation+1No attempts yet1s128 MBJudgeable
To and FroDecode a message written row by row in alternating left-to-right and right-to-left order back into column-major plaintext.Easy3StringSimulation+2No attempts yet1s128 MBJudgeable
Word RatiosFor each line of three equal-length lowercase words, apply the per-letter alphabet shift from the first word to the second onto the third, and output all four words.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Major ScalesFor each sequence of notes, list the keys whose major scale contains every note, ordered C through B.Easy3ImplementationString+2No attempts yet1s128 MBJudgeable
EcologyCount how many times each tree species line appears, then print each species in lexicographic order with its share of the total, rounded to four decimals.Easy3Hash mapString+1No attempts yet1s256 MBJudgeable
Zipf's LawFor each test case, count the words in a book body and print the words that appear exactly n times, in lowercase alphabetical order.Easy3Hash mapString+2No attempts yet1s128 MBJudgeable
SoundexConvert each uppercase word into its Soundex digit code, collapsing adjacent letters that share a digit.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
ElectionCount the votes each candidate receives in one riding, ignore unknown names, and report the winner's party or independent, or tie if there is no strict winner.Easy3Hash mapImplementation+2No attempts yet1s128 MBJudgeable
Request for ProposalGiven a set of requirements, score each proposal by how many requirements it meets, then pick the best one by compliance and price.Easy3Hash mapString+2No attempts yet1s128 MBJudgeable
ROT13Decode lines of text by reversing the ROT13 cipher: each vowel shifts three places back in a fixed vowel order, each consonant ten back in a consonant order.Easy3ImplementationString+2No attempts yet1s128 MBJudgeable
Tales from DeCryptRead three LCG parameters, then walk the ciphertext byte by byte, advancing the generator only on printable ASCII, and apply the inverse rotation to each such byte.Easy3SimulationMath+2No attempts yet1s128 MBJudgeable
Robot Roll CallGiven a roster of names and a multi-line data stream split on spaces and tabs, report for each roster name whether it appears as an exact token.Easy3Hash mapString+2No attempts yet1s128 MBJudgeable
Verdis QuoConvert valid Roman numerals to decimal integers using addition and subtraction rules.Easy3StringSimulation+1No attempts yet1s128 MBJudgeable
Defining MomentFor each word, strip at most one valid prefix and one valid suffix, then substitute the matching English meaning, expanding the suffix after the prefix.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
It's My DerivativeFor each polynomial, print its derivative and the step-by-step evaluation of that derivative at a given x, matching the input's terse notation.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Choose Your Own AdventureEach page is a node with two outgoing choices or a terminal ending; print the unique path from page 1 to the single HAPPY ending.Easy3GraphDFS+2No attempts yet1s128 MBJudgeable
Is the Name of This ProblemRead sentences until END and for each decide whether it has the form quote, phrase A, quote, space, A, printing Quine(A) or not a quine.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
SteganographyDecode hidden bits from odd/even runs of spaces in a text and decode five-bit groups into characters.Easy3StringBit manipulation+1No attempts yet1s128 MBJudgeable
NetiquetteDecide whether a one-line email breaks any of four netiquette rules about adjacent case, digits, isolated characters, or punctuation.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
Tanning SalonSimulate a tanning salon with a fixed number of beds, tracking arrivals and departures, and count how many customers leave without a bed.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
W's CipherDecrypt messages by extracting each of three character groups and rotating its subsequence right by the matching key.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Pronounceable PasswordsFor each lowercase password, check three rules: at least one vowel, no three vowels or consonants in a row, and no double letter except ee and oo.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Word AmalgamationFor each scrambled word, print all dictionary words that are anagrams of it in alphabetical order, or NOT A VALID WORD.Easy3Hash mapSorting+2No attempts yet1s128 MBJudgeable
Skew BinaryRead each skew binary string and print its decimal value, stopping at the terminating 0 line.Easy3MathString+1No attempts yet1s128 MBJudgeable
Polynomial ShowdownGiven nine polynomial coefficients from degree 8 down to the constant, print each polynomial with signs, exponents, and coefficients formatted to drop all unnecessary characters.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Basically SpeakingConvert a number from one base to another (bases 2 to 16) and print the result right-justified in a 7-character field, or ERROR if it exceeds 7 digits.Easy3MathImplementation+2No attempts yet1s128 MBJudgeable
TranspositionTranspose a list of note names by a given number of semitones, then print each note using the 12 canonical sharp names.Easy3StringHash map+2No attempts yet1s128 MBJudgeable
Take Your VitaminsFor each line of amount, unit, requirement, and name, print the rounded daily-value percentage; collect items under 1% into a trailing list.Easy3ImplementationMath+2No attempts yet1s128 MBJudgeable