Questions tagged [string]
A competition to solve a particular problem through the usage and manipulation of strings.
2,283 questions
11
votes
17
answers
909
views
Identify Redundant Regex
A redundant regular expression (regex) is defined here as a regex which has some amount of characters which can be removed while not affecting its functionality -- i.e. it matches the exact same set ...
8
votes
8
answers
961
views
Validate DNA Sequences with Telomeres
This is inspired by this homework assignment.
Telomeres are regions of repetitive DNA sequences that occur at the ends of linear chromosomes in eukaryotes (such as humans and other mammals). In ...
-8
votes
8
answers
307
views
Internationalisation -> I18n (numeronym)
Write the shortest program or function that accepts a sequence of three or more letters and returns its I18n-style numeronym, preserving the original letter case. The I18n-style numeronym is formed by ...
5
votes
4
answers
351
views
DNA reading frame
DNA is read in groups of three nucleotides (the letters you see in a sequence), called codons, for determining what protein sequence the portion of DNA will yield. I already used this in a previous ...
-5
votes
14
answers
443
views
Text Flattening Program
Input: A string, can be multi-line. The newlines must to be real newline (e.g., you cannot request that each newline be (n)). There is another input, a number (not ...
5
votes
13
answers
854
views
Which letter is missing? [closed]
Given a printable ASCII string, return any letter which is not present (ignoring case), if possible, else return the empty string.
Test Cases:
...
5
votes
3
answers
974
views
Multiply the input by 2
Your goal is to write a program which will take an input and multiply it by 2. However, there are some catches.
You will get an input in one of a few forms:
A number (...
12
votes
2
answers
232
views
Autocomplete a word at the cursor position
You will be given a block of text and a cursor position at the end of a possibly incomplete word.
You must output a suggestion for what this word (let's call it w) ...
12
votes
15
answers
2k
views
Unroll the loop!
A loop is a rectangle of text like this:
hgf
ile
jkd
abc
To unroll it, you start at the bottom left, and proceed to the right, spiralling anti-clockwise in towards ...
21
votes
10
answers
2k
views
"e" ejects the letters. Re-enter them
Overview
I have a sample of 10 quotes. You will receive as input to your program one of these quotes, however all the vowels (aeiou) will be replaced with the ...
2
votes
4
answers
617
views
Program Generator: Print a Paragraph
Objective
Your challenge is to write a program that, given a paragraph from a book, will output another program that prints out that paragraph. (See my example program in an answer)
Scoring
The link ...
5
votes
3
answers
429
views
Cancel strings to make them short
Overview
You will be given a list of strings. If any two elements are equal, you can delete both of them. If one element a is a substring of element ...
9
votes
11
answers
2k
views
Recognize my coworker
My work has recently changed the employee tracking system to one that happens to include a fun game to learn your coworker's faces:
Just a small problem: all the pictures include that person's ...
16
votes
8
answers
1k
views
Output shortest string containing all input strings
Given a list of words (letters only) in no particular order, output the shortest string containing every word (disregarding case). Output must be lowercase, except the first letter of each word is ...
12
votes
3
answers
2k
views
The shortest NP-complete problem
Find an NP-complete problem that covers all finite ASCII strings, and present a solver for the problem in the programming language of your choice.
By the definition, if there is a finite ASCII string ...
28
votes
27
answers
4k
views
Reverse NATO Phonetic Spelling
NATO Phonetic Spelling is a way to spell out letters so that they're distinguishable over a noisy connection. The mapping of letters (stolen from here) is as follows:
...
4
votes
4
answers
218
views
Shortest TeX document that generates ``Overfull \hbox`` Warning
Attempt to produce the shortest TeX document that generates the warning
Overfull \hbox (<x>pt too wide) in paragraph at lines <y>--<z>
that ...
19
votes
12
answers
1k
views
Print Dyck paths
Definition
A Dyck path of length \$2n\$ can be defined as a two-dimensional path such that:
The path consists of straight lines of equal length.
The path goes left to right while moving either up or ...
21
votes
20
answers
3k
views
Albuququerquerquerquerque challlengenge
Introduction
Esolangs.org user "Tommyaweosme", after getting 3-4 hours into a 17-hour video called "albuquerque but every time a word repeats it loops (normal speed)", created this ...
23
votes
10
answers
2k
views
Turn a string into a snake
Write a function or program which writes an input string out as a snake.
The snake starts heading to the right. If a / or \ ...
12
votes
14
answers
1k
views
Decide Equality of Closed Surfaces
Objective
Given two closed surfaces (a.k.a. closed 2-manifolds), decide whether they're homeomorphic.
Introduction
In lay terms, a closed surface is a finite-sized shape that resembles a flat plane ...
9
votes
19
answers
1k
views
Determine Centrosymmetric String
Let's define a centrosymmetric string as follows:
First, add spaces to the end of each line to make the input a rectangle \$ A_{m×n} \$, the number of spaces added should be minimized and may be zero....
16
votes
12
answers
989
views
Repetition-restricted strings
Given an alphabet size, \$n>0\$, and an occurrence limit, \$k>0\$, produce the number, \$a(n, k)\$, of strings that may be constructed from the \$n\$ letters in the alphabet which have no more ...
13
votes
9
answers
893
views
split string into minimum number of palindromic substrings [duplicate]
Every string can be split into substrings that are all palindromes quite easily. For example, "abab" can be split into the palindromes ...
6
votes
5
answers
723
views
Interpret a SqueezeL string
Interpret a SqueezeL string
SqueezeL is a golfing language I'm developing. Its main distinguishing feature is its 40 character code page, which led me to create a semi-complicated encoding method for ...
27
votes
25
answers
1k
views
Distinct characters and distinct sizes
In this challenge you will write a program or function which takes a string and calculates its score.
The score is the number of distinct characters, plus each integer \$n\$ such that there is a ...
23
votes
16
answers
2k
views
Print the largest hidden double
Given a string of space delimited words, find the longest word such that, when that word is replaced with spaces, it is still a subsequence of the remaining string. Then, replace everything, except ...
9
votes
18
answers
2k
views
All code and no play makes 31415 a dull boy
In this crossword puzzle by Jack Lance, all the letters have been replaced by a fixed text string: All work and no play makes Jack a dull boy. Therefore, you have ...
11
votes
6
answers
1k
views
Tracing light through a house of mirrors
Suppose you find yourself in a house of mirrors! You stand in the corner, and you trace how your image reflects off of mirror A, followed by mirror B, followed by mirror C, followed by mirror A.
But ...
6
votes
16
answers
2k
views
Mega Man: Powered Up
Objective
Given the name of a robot master in Mega Man: Powered Up except the trailing string Man, output the name of the robot master (again, except the trailing ...
9
votes
17
answers
1k
views
Spellcheck I Before E
Background
As the old saying goes, "I before E, except after C". Whilst we already know exactly how true that saying is, I am a stickler for sayings, especially those that rhyme. I want you ...
33
votes
21
answers
3k
views
Count the fish in a school
Go Fish!
Given a school of fish, for example:
...
7
votes
8
answers
997
views
Solve the "word break problem" in a single line of code
Challenge
Solve this problem in the fewest number of bytes of code possible.
Write code that takes a string \$str\$ and a dictionary-list of words \$d\$ and finds all combinations of words from \$d\$ ...
21
votes
17
answers
2k
views
Building Skyscrapers
You work as an architect, and you've been assigned the task of reviewing your coworker's skyscraper design. In your line of work, a skyscraper is just a tower of blocks. Nothing more, nothing less.
...
17
votes
10
answers
2k
views
Convert French spelled out numbers to integers
Given a string that is a number between 0 and 100 (included) spelled out in French, write a function (or a whole program) that outputs the corresponding integer.
List of all test cases :
...
14
votes
19
answers
2k
views
The shortcut hint
Given a string and a char, add an underscore (_, which won't appear in the input) before any one instance of the char, case-insensitive; if the char never appears ...
6
votes
15
answers
2k
views
`Vo we l spa ci ng`
Today you are having a silly problem.
...
29
votes
38
answers
3k
views
How many dots are there?
Given a string of printable ASCII, count the dots.
The following characters have one dot each: i j ...
14
votes
13
answers
1k
views
Simplified canvas builtin
related
The golfing languages 05AB1E and Vyxal have a "canvas" builtin that draws a string on a ASCII grid. In this challenge, you'll be implementing a simplified form of this.
You should ...
17
votes
6
answers
2k
views
Draw a string as a binary tree
The string abcdefghijklmno, with length 24-1, can be formatted as such:
...
7
votes
2
answers
355
views
Snake a string through a simplex
An n-simplex is a generalization of 'triangleness' in any dimension (specifically, it is the simplest shape requiring n dimensions). Starting with 0 dimensions, the named simplexes are: point, line ...
-1
votes
1
answer
98
views
Function to Convert string to Hexadecimal [duplicate]
Assignment:
Create a function that can convert a string to its encoded hexadecimal value.
In your answer, also show how to run this function (to validate answers).
Your function must return OR print ...
7
votes
8
answers
670
views
Curry a C function pointer [closed]
Objective
Given a type signature of a C function pointer represented as a string, output the (fully) curried version of it, also as a string.
I/O format
It is assumed that:
There is at least one ...
14
votes
16
answers
2k
views
Reduce a string up to idempotency [closed]
Objective
Given a string consisting of printable ASCII characters (!0x21 ― ~0x7E), treat it as an element in the free idempotent ...
3
votes
1
answer
226
views
How comparison-heavy is this list? [closed]
Given a list of strings in any convenient format display the amount of comparisons between individual characters that a merge sort algorithm would perform.
The merge-sort algorithm is a divide & ...
24
votes
20
answers
2k
views
Simulate Text Cursor
You are given a string [A-Za-z|]+ that contains exactly one occurrence of | denoting the current position of the cursor and a ...
9
votes
12
answers
3k
views
Keyboard Ping Pong
Keyboard Ping Pong
(This question was inspired by this post.)
Challenge
Given a string of letters, determine if the word "ping-pongs" across the keyboard. (Letters alternating between sides ...
27
votes
43
answers
3k
views
Segments of a string, doubling in length
Simple task today. Given a string whose length is one less than a whole power of 2, divide it into segments with doubling length.
For example for the string ...
1
vote
2
answers
277
views
Write a function that takes an input string and encodes it using a modified Fibonacci sequence in reverse [closed]
Given an input string, first convert each character to its ASCII value.
Generate a reversed Fibonacci sequence of the same length as the input string.
Encode each character by adding its ASCII value ...
0
votes
3
answers
571
views
Sum of Positive and Negative Powers of 2
Given a binary string equivalent to \$n\$, write out the least possible number of terms needed to express \$n\$.
A term is defined as an addition of either \$2^k\$ or \$(-2^k)\$, where \$k\$ is a non-...