Curated sets

Strings and text

Parsing, matching, and tries.

All problems
Total results1,816 problems
TopicsJudge
Spelling BeRead a dictionary and several emails, then report for each email whether all its words are known and list the unknown words in order.Easy3Hash mapString+2No attempts yet1s128 MBJudgeable
Counting PagesGiven a document's page count and a comma-separated list of page ranges, count the distinct pages that are actually printed, ignoring empty ranges and pages past the end.Easy3ImplementationString+2No attempts yet1s256 MBJudgeable
DanceCheck a sequence of dance steps against five textual rules and report which rules it violates, uppercasing any misplaced dip.Easy3ImplementationString+1No attempts yet1s128 MBJudgeable
Look and SayFor each input string of digits, produce the next look-and-say element by counting runs of equal digits and writing each count followed by the digit.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
Seven-Segment Display AdditionDecode two seven-segment code strings into integers, add them, then re-encode the sum using the given digit codes.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Casting Out NinesFor each line like a+b=c. or a*b=c., compute digit sums modulo 9 and print PASS if the operation is congruent, otherwise NOT!.Easy3MathNumber theory+2No attempts yet1s128 MBJudgeable
A Balanced WorldFor each line ending in a period, decide whether its round and square brackets are properly matched and nested, printing yes or no.Easy3StackString+1No attempts yet1s128 MBJudgeable
MCXI Numeral SystemRead two MCXI-strings, add their values, and print the canonical MCXI-string for the sum.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Car ParkSimulate a sequence of car entry and exit signals for a car park of capacity S starting with C cars, stopping early if an exit occurs while empty.Easy3SimulationImplementation+1No attempts yet1s128 MBJudgeable
ShirtsMerge two already sorted lists of shirts and print one merged list ordered by size, then by colour letter. Multiple scenarios end with a 0.Easy3SortingTwo pointers+2No attempts yet1s128 MBJudgeable
Letter ReplacementReplace each repeated letter in a word with a symbol assigned in the order letters first repeat, comparing case-insensitively.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
TargetGiven all solution words of a letter puzzle, recover the 9 grid letters and place the letter common to every word in the middle.Easy3ArrayHash map+1No attempts yet1s128 MBJudgeable
Coded CommunicationGiven n binary strings of length b and a received string r, find the minimum Hamming distance from r to any of the n strings.Easy3StringBrute force+2No attempts yet1s128 MBJudgeable
Grocery ShoppingFor each grocery item, find its matching store item by case-insensitive name and add the club-card saving on the units actually bought.Easy3Hash mapString+1No attempts yet1s128 MBJudgeable
Subway FaresGiven a per-stop fare table and an ordered list of station names, find the number of stops between two stations and print the corresponding fare.Easy3ArrayString+2No attempts yet1s128 MBJudgeable
Campus BuildingsGiven building names and an abbreviation, list the names whose letters contain the abbreviation as a case-insensitive subsequence, in input order.Easy3StringTwo pointers+1No attempts yet1s128 MBJudgeable
A Minor and C MajorSplit the score at bar lines, count how many measure-initial notes are A, D, E versus C, F, G, and break ties with the last note.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
Base KConvert each n to base k and report whether every digit from 0 to k-1 appears, formatting the output line exactly as specified.Easy3MathImplementation+2No attempts yet1s128 MBJudgeable
Longest Decreasing SuffixFor each string, print its longest suffix whose characters strictly decrease from left to right.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Mining MapsParse each graph block, count distinct node names, and count distinct undirected tunnels including self-loops.Easy3Hash mapGraph+2No attempts yet1s128 MBJudgeable
Parity BitSplit each line into 8-bit blocks, check whether the parity bit matches the parity of the first 7 bits, and count the mismatches.Easy3ImplementationString+2No attempts yet1s128 MBJudgeable
PLU CountFor each text string, find the largest k such that PLU repeated k times is a subsequence, ignoring case.Easy3GreedyString+1No attempts yet1s128 MBJudgeable
Duplicate SSNRead a list of Social Security numbers until the sentinel 000-00-0000, then print every number that appears more than once in ascending order.Easy3Hash mapSorting+2No attempts yet1s128 MBJudgeable
DecoderEach word contributes one letter: the first letter of the first word, then the k-th letter of each word where k is the previous word's length; spaces appear when the previous word is too long.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Secret LetterGiven a ciphertext, undo a 90-degree clockwise rotation of a square grid to recover the original letter.Easy3ImplementationArray+2No attempts yet1s128 MBJudgeable
RingsCount how many of N rings, each a 10-letter circular string, contain a given search string when read around the circle.Easy3StringString matching+2No attempts yet1s128 MBJudgeable
Look-and-Say StringApply the look-and-say run-length encoding to a digit string n times and print the resulting string.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Character ConversionMap each character according to a conversion table where every replacement happens exactly once, and print the resulting string.Easy3Hash mapImplementation+1No attempts yet1s128 MBJudgeable
Calculator ProgramRead alternating numbers and operators, evaluate left to right ignoring precedence, and print the value when = appears.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Rotary DialGiven an uppercase word, map each letter to its phone digit and sum the dial times, where digit d costs d+1 seconds and 0 costs 11.Easy3ImplementationString+1No attempts yet1s128 MBJudgeable
Longest WordScan text until the token E-N-D, split it into words made of letters and hyphens, and print the longest such word in lowercase, breaking ties by first occurrence.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
In BrailleTranslate a string of digits to Braille cells, or three lines of Braille cells back to digits, using the fixed digit-to-cell table.Easy3StringHash map+2No attempts yet1s128 MBJudgeable
TautogramFor each sentence, decide whether every word begins with the same letter, ignoring case, until a line containing only *.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Find the CowCount ordered pairs of indices (x, y) with x < y where an "((" starts at x and a "))" starts at y in a parenthesis string.Easy3StringPrefix sum+2No attempts yet1s128 MBJudgeable
17 TimesGiven a binary number N of up to 1000 digits, print N times 17 in binary.Easy3StringMath+2No attempts yet1s128 MBJudgeable
Adding CommasInsert a comma every three digits from the right in a given integer and print the formatted number.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Cow CotillionGiven strings of '<' and '>', decide for each whether every character can be paired as a properly nested '><' bow, i.e. whether the brackets are balanced.Easy3StackString+2No attempts yet1s128 MBJudgeable
Encrypted SMSEach encrypted letter was shifted forward within its phone keypad key by its 1-based position; given the ciphertext, recover the original password.Easy3StringSimulation+1No attempts yet1s128 MBJudgeable
URLsParse each URL into protocol, host, optional port, and optional path, printing <default> for missing components.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Digital RootGiven positive integers up to 1000 digits, each line until a terminating 0, print the digital root of each number.Easy3MathNumber theory+2No attempts yet1s128 MBJudgeable
Adam's GenesProcess cloning requests in order, tracking each clone's accumulated genes and reporting whether it is consistent and safe, disconnected from Adam, or doubly mutated.Easy3Hash mapSimulation+2No attempts yet1s128 MBJudgeable
Unix ls Column FormattingSort filenames by ASCII value and lay them out in column-major order with fixed-width padding, as few rows as fit in 60 characters.Easy3SortingImplementation+2No attempts yet1s128 MBJudgeable
PalindromesFor each string, decide whether it reads the same backward and whether replacing each character by its mirror and reversing gives the same string.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Evaluating Simple C ExpressionsEvaluate a sequence of simple C expressions with +, -, and prefix or postfix ++/--, printing the expression value and the final values of used variables.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Genetic CodePrint the first n characters of the infinite square-free sequence generated by the substitution N→NOP, O→NP, P→O.Easy3StringRecursionNo attempts yet1s128 MBJudgeable
SubsequenceFor each line of input, decide whether the first string is a subsequence of the second, printing Yes or No.Easy3Two pointersString+2No attempts yet1s128 MBJudgeable
Average is not Fast Enough!Parse each team's section times in h:mm:ss form, sum them, and print the average seconds per kilometer rounded to the nearest second, or a dash if any runner was disqualified.Easy3ImplementationString+2No attempts yet1s128 MBJudgeable
HTMLRender an HTML fragment of plain text with <br> and <hr> tags, wrapping lines at 80 characters.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
Artificial Intelligence?Given a word problem stating two of power, voltage, and current with optional metric prefixes, compute the missing quantity using P = U * I.Easy3StringMath+1No attempts yet1s128 MBJudgeable
On-Line BankingSimulate a stream of bank commands (create, deposit, withdraw, transfer) over many scenarios and print the result of each request.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
Read the ChessboardGiven an ASCII-art chessboard, list each side's pieces in standard notation, grouped by type in a fixed order and sorted by position rules.Easy3ImplementationString+2No attempts yet1s128 MBJudgeable
Add Backward NumbersAdd two numbers whose digits are given in reverse order, printing the sum with its digits also reversed and no leading zeroes.Easy3MathString+2No attempts yet1s128 MBJudgeable
Aromatic NumbersGiven a string alternating Arabic digits and Roman numeral letters, sum each digit times its Roman value, subtracting a pair when the next Roman value is larger.Easy3StringImplementation+1No attempts yet2s512 MBJudgeable
Global WarmingGiven a sequence of temperatures, find the length of the shortest period of the sequence of consecutive differences, allowing the final repetition to be truncated.Easy3String matchingBrute force+2No attempts yet2s512 MBJudgeable
Huffman EncodingGiven prefix-free binary codes for up to 20 letters, decode a binary string of at most 250 digits back into the original letters.Easy3TrieString+2No attempts yet2s512 MBJudgeable
SignageGiven a sign width, lay out a fixed sentence into lines, justifying each line so spaces are spread as evenly as possible, and print dots for spaces.Easy3StringSimulation+2No attempts yet1s128 MBJudgeable
Cell-Phone MessagingGiven words, compute the typing time on a phone keypad where each press takes 1 second and switching between letters on the same key adds a 2-second pause.Easy3ImplementationString+2No attempts yet1s128 MBJudgeable
Returning HomeReverse a short list of turn directions and street names, flipping each left or right turn, to produce the route from school back home.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
Fix-Free CheckFor each triple of words, decide whether no word is a prefix or suffix of another, printing Yes or No.Easy3StringBrute force+2No attempts yet1s128 MBJudgeable
PoetryFor each four-line verse, extract the last syllable of the final word on every line and print which rhyme scheme it matches.Easy3StringImplementation+2No attempts yet1s128 MBJudgeable
BFedInterpret a Brainfuck program read from stdin up to '#', supporting the seven pointer, arithmetic, loop, and output commands on a 30000-cell byte tape.Easy3SimulationStack+2No attempts yet1s128 MBJudgeable
Keeping ScoreParse a 13-card hand grouped by suit, score high cards and short suits, and print each suit with points right-aligned in a fixed table.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Numbers That Read the Same Upside DownCount how many integers in the interval [m, n] stay the same when rotated 180 degrees, using the digit map 0, 1, 8, 6, 9.Easy3MathImplementation+2No attempts yet1s128 MBJudgeable
SurfingParse links out of HTML pages, print each link, then answer reachability queries between pages.Easy3GraphDFS+1No attempts yet1s128 MBJudgeable
Card GameSimulate a 52-card game where players alternate turning cards; award points when a high card is followed by enough non-high cards, then print each score.Easy3SimulationImplementation+2No attempts yet1s128 MBJudgeable
CensorRead n lines of space-separated words and replace every word of exactly four letters with ****, printing a blank line between consecutive output lines.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
SentencesGiven lists of subjects, verbs, and objects, print every subject-verb-object sentence in alphabetical order, with a blank line between datasets.Easy3Brute forceSorting+2No attempts yet1s128 MBJudgeable
Dynamic Dictionary CodingCompress each text set by replacing repeated words with their 1-based dictionary positions, leaving first occurrences unchanged, and preserve all spacing.Easy3StringHash map+2No attempts yet1s128 MBJudgeable
Guessing Game ICompare a 4-digit secret and a guess digit by digit, count exact-position matches as circles and remaining cross-position matches as squares, with duplicates matched once.Easy3ImplementationHash map+2No attempts yet1s128 MBJudgeable
Word Problem (TEKSTER)Parse variable values embedded in a word problem, then evaluate the student's step-by-step arithmetic and print the last step's result.Easy3ImplementationString+2No attempts yet1s1024 MBJudgeable
EncryptionGiven a string encrypted with the rule x -> x^3 mod 29 + 1, recover and print the original symbols.Easy3ImplementationMath+2No attempts yet1s1024 MBJudgeable
Scrabble ScoringScore each Scrabble play by parsing its start square and direction, applying letter and word bonus multipliers from the fixed 15x15 board.Easy3ImplementationSimulation+2No attempts yet1s128 MBJudgeable
A DP ProblemParse each linear equation without parentheses, solve for x, and report the floored solution or whether it is impossible or an identity.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Automatic PoetryGiven a bracketed first line and a truncated second line ending in dots, rebuild the second line by splicing the bracket contents in the order s4s3s2s5.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
BracketsFor each line of code until the '#' line, decide whether its round, square, and curly brackets are matched and correctly nested.Easy3StackStringNo attempts yet1s128 MBJudgeable
AnagramsGiven several word lists, print the first word in each list that has the most anagrams, along with that count.Easy3Hash mapString+1No attempts yet1s128 MBJudgeable
ScrabbleGiven up to 1000 short dictionary words and a set of letter and blank tiles, count how many words the tiles can spell.Easy3ArrayString+2No attempts yet1s128 MBJudgeable
Simple Prefix CompressionSum stored lengths after prefix compression: each string stores a control byte plus the part not shared as a prefix with the previous string.Easy3StringImplementationNo attempts yet1s128 MBJudgeable
Sequences without StammersPrint the smallest alphabet size for which a square-free (stammer-free) string of length n exists.Easy3StringCombinatorics+1No attempts yet3s128 MBJudgeable
JasioCount words that contain a palindrome substring of length at least 2, both literally and with i=j and p=b=d treated as equal.Easy3StringImplementation+1No attempts yet1s128 MBJudgeable
Chaos and the StonkiEach entry is a name with hyphens inserted anywhere and letters possibly lowercased; count how many distinct real names (uppercase only) appear.Easy3StringHash map+1No attempts yet1s128 MBJudgeable
NecklacesSplit each circular necklace string into runs of equal size and shade and report the longest and shortest run, preferring larger then lighter beads on ties.Easy3SimulationStringNo attempts yet1s512 MBJudgeable
StatisticsCount how many times each requested item appears in the article: spaces, digit runs, letter runs, period-ended sentences with a word, and palindromic words.Easy3StringImplementationNo attempts yet1s512 MBJudgeable
LotteryChange as few letters of the given A, B, or C string as possible so no two neighbors match.Easy3GreedyStringNo attempts yet1s128 MBJudgeable
PalindromeFrom the given words, pick two at different positions so their concatenation is a palindrome and report the lexicographically smallest one.Easy3Brute forceString+1No attempts yet1s256 MBJudgeable
Stuttering StringsFor each input case, the program prints every length-n string over * and ! whose runs stay within the given limits, in lexicographic order with * first.Easy3BacktrackingRecursion+1No attempts yet1s128 MBJudgeable
Circular SequenceFind the lexicographically smallest rotation of each given circular DNA string.Easy3StringBrute forceNo attempts yet1s128 MBJudgeable
Iris (Password)Count case-insensitive subsequence occurrences of a word in a text with the prescribed greedy scan and print the count with up to the first three end positions.Easy3GreedySimulation+1No attempts yet1s128 MBJudgeable
The Brave Sir Robin's cAsE cOrReCtOrThe program uppercases each letter after terminal punctuation seen across spaces and parentheses, decimal points excluded, and lowercases the rest.Easy3StringSimulationNo attempts yet1s128 MBJudgeable
Constant IrritationTranslate each assembler storage line from suffixed numeric constants into the matching C-style directive and literals.Easy3ImplementationStringNo attempts yet1s128 MBJudgeable
Approximate String MatchingFor each word pair, try every offset, keep the largest count of matching letters, and print twice that count over the total length as a reduced fraction.Easy3String matchingBrute force+1No attempts yet1s128 MBJudgeable
Fun with fractionsAdd up to 999 mixed numbers, integers, or fractions per test case and print each sum in lowest terms as a mixed number.Easy3MathImplementation+1No attempts yet1s128 MBJudgeable
The Queen's EnglishSpell each integer below one billion in formal British English words with hyphens and ands.Easy3ImplementationStringNo attempts yet1s128 MBJudgeable
Jumble MatchCount how many given words contain a substring that is a rearrangement of the pattern, where underscores match any letter.Easy3Sliding windowString+1No attempts yet1s128 MBJudgeable
Virus ReplicationGiven the DNA strands before and after one contiguous replacement, find the shortest inserted piece that explains the change.Easy3StringTwo pointersNo attempts yet1s128 MBJudgeable
E-Mail SnoopingCount how many listed keywords appear as whole words in the email and raise an alarm when the count reaches the threshold.Easy3StringHash mapNo attempts yet1s128 MBJudgeable
False Sense of SecurityDecode each line by turning it into pause-free Morse code, reversing the per-character length digits, and re-splitting the code into text.Easy3StringSimulation+1No attempts yet2s128 MBJudgeable
The real messageDecide whether a received uppercase message could result from duplicating every third occurrence of each letter.Easy3SimulationStringNo attempts yet1s256 MBJudgeable
ChromosomeDecide for each uppercase string whether it matches an optional A-to-F letter followed by runs of A, F, and C and an optional closing letter.Easy3String matchingStringNo attempts yet2s64 MBJudgeable
String LDCount how many times the first character can be stripped from every word before a word empties or two words match.Easy3StringSimulation+1No attempts yet1s128 MBJudgeable