Questions tagged [string]
A competition to solve a particular problem through the usage and manipulation of strings.
2,058
questions
11
votes
15
answers
5k
views
LOOOOONG TEEEEEXT
Definition of long text
Long text usually shows emphasis, for instance, loooooool or yaaaaaaaaaay. Usually the vowel is ...
11
votes
7
answers
281
views
Convert Alpha-2 to Alpha-3
The Task
The task is easy: given an Alpha-2 country code, output the Alpha-3 equivalent. The input may be in any case you choose, and the output in any consistent case of your choosing. Here are the ...
27
votes
5
answers
3k
views
Haplololololololology!
Haplology
Haplology is a linguistic term:
the omission of one occurrence of a sound or syllable that is repeated within a word, for example probly for probably.
For this challenge, it means ...
20
votes
8
answers
2k
views
ASCII-Art n'th Root
Challenge:
Given two integers \$a\$ and \$b\$, with lengths \$A=length(a), B=length(b)\$, output an ASCII-art of the \$a^{th}\$ root of \$b\$, including the answer rounded to \$A\$ amount of decimal ...
26
votes
28
answers
2k
views
Derivative of a product
In calculus, the derivative of a mathematical function defines the rate at which it changes. The derivative of a function f(x) can be marked as ...
15
votes
13
answers
3k
views
Who needs 8 bits for one character?
Given a string and the characters used to encode it, you need to compress the string by only using as many bits as each character needs. You will return the character codes for each character needed ...
11
votes
7
answers
636
views
Shortest restricted superstring
Given two sets of strings, \$ D \$ and \$ R \$, find the shortest string which contains every string in \$ D \$, but contains none of the strings in \$ R \$.
There are almost always multiple possible ...
19
votes
8
answers
2k
views
Convert Alpha-3 to Alpha-2
I've been developing some programs involving me fetching a vector from a url using Alpha-2 country codes (such as GET /jp.svg for Japan). Except, oh no! All the ...
14
votes
22
answers
2k
views
Shift a string gradually
Given an input string and a wrapping string, find the location of the first input string char in the wrapping string and replace it with the wrapping string char 1 step to the right of that, find the ...
9
votes
5
answers
868
views
Spell out an integer... in NDos' way
Objective
Given a positive integer, spell it out in the conlang I made.
Specification
Let \$n\$ be the inputted integer. \$n\$ shall be spelled out in the following specification. The entire spelling ...
16
votes
23
answers
1k
views
Pair my brackets
Given a string consisting of ()[]{}, print the paired brackets in the same order as they appear in the string.
Any opening bracket ...
12
votes
18
answers
1k
views
Words with Easy Letters in a Word Search
Introduction:
Apparently I keep coming up with word search related challenges lately. :)
When I do the word search in the Dutch news paper, some words are very easy to find because they contain ...
9
votes
5
answers
299
views
Convert the type modifiers from prefix to C-fix
Given a base type T, this can be augmented with * or [], each meaning pointer and array. For ...
19
votes
8
answers
2k
views
Optimally break a string into words
Given a string, like potatocarrot, break it into the smallest number of substrings possible. These substrings can consist either be a single character, or one of a ...
14
votes
8
answers
732
views
Organize a Kiowa library
We are probably all used to the English alphabetical order:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
When we compare words in English for the sake of ...
17
votes
17
answers
1k
views
Play Caesar's Cipher with Letters only
Description
The Caesar cipher is a cipher, where every letter in the alphabet will be rotated by a secret number.
If the rotation is \$7\$, then a -> ...
11
votes
19
answers
3k
views
What's the Missing Code? (Robbers)
Robbers' Challenge
Read the cops' challenge first.
In this cops-and-robbers challenge, you (the robbers) must find the correct string of characters, which, when added into the cop's code, will make it ...
26
votes
28
answers
3k
views
What's the Missing Code? (Cops)
Cops' Challenge
Robbers' challenge here.
It has now been four days since the challenge was posted so all new answers should be marked as non-competing in the title. These answers can still be cracked ...
13
votes
9
answers
920
views
Remove unmatched brackets
Inspired by @AviFS.
Given a string containing brackets, e.g.
[xyz]]abc[[def]hij[
You can parse through it with a stack of brackets. When you find an open bracket, ...
10
votes
8
answers
2k
views
How many times do I break my own rule?
Introduction:
In my recent Strikethrough the Word Search List challenge I mentioned the following:
When I do the word-search puzzles, I (almost) always go over the words in order, and strike them ...
6
votes
15
answers
897
views
Spaceship shooter
Your task is to output a spaceship of size n with shooters/guns and n bullets of character - ...
11
votes
14
answers
871
views
Arrange a Haft-Sin table
It's Nowruz and you want to set up a Haft-Sin table by words. This means finding seven words that start with letter s.
The Challenge
Write a program which its input is a list of words separated by ...
13
votes
14
answers
2k
views
Sandbox overflow
Your task is to output a square sandbox of size n+2 with / characters in the corners and | ...
10
votes
6
answers
413
views
The Missing Match
You are given a string of unknown length that contains a varied amount of (, {, [ and their ...
22
votes
32
answers
5k
views
Negative of an ASCII photo
Task
Given an \$m\times n\$ binary ascii "photo", return the negative of the photo
Example:
...
11
votes
25
answers
1k
views
Circular chained compound
Task
Given a positive integer n, output the joined compound of circles
The circles are of square of size n+2 but removing the ...
3
votes
9
answers
1k
views
int, float or neither?
Given a string, determine if it is an int, a float or neither.
Examples
123 - int
62727.0033 - float
644c.33 - neither
Your code should output a different value depending on which it is. For example ...
25
votes
13
answers
853
views
Resolve references in a chat discussion
Sometimes in chat, if someone says something you agree with, you'll send a message with an ^, which points at the message above:
...
2
votes
5
answers
142
views
Generate this string table [duplicate]
For the given string s, generate generate a table like below.
...
14
votes
16
answers
1k
views
Building spikes
Inspired by this building (United States Air Force Academy Cadet Chapel, Colorado)
Your task is simple, given a positive integer n, output the spiked building to ...
12
votes
7
answers
653
views
S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ the Word Search List
Introduction:
Every workday I read the newspaper in the morning while eating breakfast, and also do some of the puzzles at the back. When I do the word-search puzzles, I (almost) always go over the ...
15
votes
3
answers
337
views
What was my Wordle play?
Task
Given a winning Wordle play results (clues), the target ("secret") word and a list of words, output a possible sequence of words leading to such results.
The words in the list will be ...
12
votes
20
answers
1k
views
Convert a string of ASCII characters to base-3 equivalents
Task similar to this one. Take a string of ASCII characters and convert it to base-3 equivalents separated by a space.
For example:
Hello, world!
Should be ...
21
votes
10
answers
1k
views
Pretty print my arrays
I like to pretty print multidimensional arrays, like this:
[ [ [1, 2, 3],
[4, 5, 6] ],
[ [7, 8, 9],
[6, 4, 2] ] ]
But it's a pain to do by hand and it'd ...
12
votes
7
answers
695
views
Knights Jam | Chess
The knight is a chess piece that, when placed on the o-marked square, can move to any of the x-marked squares (as long as they ...
12
votes
5
answers
888
views
Simulating Bombs
More advanced version of this
The aim of this puzzle is to simulate the impact of the shock wave of bombs on a square grid. The grid initially contains cells labelled ...
16
votes
17
answers
1k
views
Capture the longest leading whitespace substring from lines
The Challenge
Given a multiline string, return the longest substring of leading whitespace present in every line, ignoring empty lines or lines composed only of whitespace. If input is empty or ...
12
votes
8
answers
801
views
Spinning Word Search
Introduction:
Pete likes doing word search puzzles. Despite that, he has trouble searching for words vertically, (anti-)diagonally, or reversed. Because of that, he'll always search for the words left-...
5
votes
6
answers
2k
views
Real-world progress bar
Backstory, skip if you like
Generating high quality pseudo random numbers is a tricky business but the fine engineers at < enter company you love to hate > have mastered it. Their progress bars ...
16
votes
18
answers
1k
views
Triangle Tripler
Simpler version of this
Task
You must create a program that outputs a triangle of a given size N.
A triangle is made of 3 identical triangles
A triangle of size N should be made of N lines
A triangle'...
19
votes
7
answers
2k
views
Find my Māori pronouns
The Māori language has quite simple pronouns. It uses a single word for he/she/they/etc (ia), and the words for "you" and "me" are ...
22
votes
7
answers
847
views
Happy new year string builder
This question is inspired by this awesome answer.
The challenge is to write a program or function which takes in a positive integer, and outputs "Happy new year to you" or a slight variation ...
7
votes
9
answers
2k
views
Write a spam-detection program
You work for a social media platform, and are told to create a program in a language of your choice that will automatically flag certain post titles as "spam".
Your program must take the ...
17
votes
6
answers
876
views
Retaining Water
Your task is to check the volume of water in a pool. Your have to create a program that takes in a input that is represented by an 10 by 10 grid of integers, with ...
22
votes
16
answers
1k
views
Find the index of the matching parentheses for each character
The challenge is simple, find the matching parentheses for every one of the parentheses in a given string input
E.g.
()()() -> [1, 0, 3, 2, 5, 4]
Always start ...
42
votes
17
answers
6k
views
Highlight a Wordle guess
In Wordle, you try to guess a secret word, and some letters in your guess are highlighted to give you hints.
If you guess a letter which matches the letter in the same position in the secret word, the ...
13
votes
7
answers
526
views
Crack the Caesar cipher
The Caesar cipher is a simple and famous cipher, where the letters of the alphabet are rotated by some secret amount. For example, if our secret rotation is 3, we ...
12
votes
10
answers
805
views
From code to golf (Cops' thread)
This is a cops-and-robbers challenge, the robbers' thread is here
You can change the word code into golf by changing a letter at ...
17
votes
24
answers
1k
views
Is this word in standard order?
Let \$ A \$ represent the alphabet, such that \$ A_1 = \$ a and \$ A_{26} = \$ z.
Let's define that a word \$ W = w_1 w_2 ... ...
17
votes
44
answers
2k
views
Remove odd indices and double the even indices
Your task is simple, just remove the odd indices and double the even indices
Example
the input is Hello, World! and we get indices
...