Questions tagged [string]
A competition to solve a particular problem through the usage and manipulation of strings.
2,062
questions
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
808
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
...
13
votes
12
answers
1k
views
Mat Printing Matrix
A manufacturing company wants to print a design on mats of varying dimensions, and they hired you to program a robot to make these mats. The design consists of alternating rings of any 2 symbols on a ...
15
votes
4
answers
321
views
Sides of a polygon
Given an ASCII-art shape made of the characters /\|_, your challenge is to return the number of sides it has.
A side is a straight line of one of those, for example:...
8
votes
4
answers
220
views
Split along groups (hard mode)
This is an alternate version of this earlier challenge with a twist that adds a significant bit of difficulty.
Like last time, you are going to be given a string containing some alphabetic characters ...
-3
votes
5
answers
176
views
Rotate a grid 90 degrees clockwise
The task is simple, given an integer n of how many lines the next n lines is and, a multi-line input, output the resulting 90 ...
17
votes
6
answers
1k
views
Is this continuous terrain?
Very related
You're given a piece of ASCII art representing a piece of land, like so:
/‾\
__/ ‾\_
\_/‾\
\
Since an overline (...
19
votes
8
answers
483
views
Split along groups
You are going to be given a string containing some alphabetic characters along with [ and ]. Your task is to split into ...
20
votes
42
answers
3k
views
Is it a pure word?
Introduction
A pure word (or perfect word), as defined by me, is a word where the sum of the position in the alphabet of each letter in the word is perfectly divisible by the total length of the word. ...
10
votes
8
answers
589
views
Expand a Rubik's Cube Commutator
Background
We will be using a 3x3 cube for this challenge.
Rubik's cubers have their own notation for movements on the cube:
Each of the 6 faces has a clockwise turn notated with a single capital ...
19
votes
8
answers
444
views
Fill the (possibly leaky) bowl
Challenge:
Given an ASCII art of a (possibly leaky) bowl consisting of a random distinct non-whitespace and non-~ character, fill it completely with ...
18
votes
28
answers
3k
views
Make every other vowel uppercase
Given a lower case string. Ex:
s = 'abcdefghijklmnopqrstuvwxyz'
The goal is to make every other vowel uppercase.
Desired output here:
...
24
votes
27
answers
1k
views
Check if the string is reshaped
Challenge
Given an input string X, determine if X can be obtained from reshaping a strict prefix of itself (a prefix that is not ...
20
votes
13
answers
626
views
Self-unshuffling strings
To shuffle a string \$s\$, Alice applies the following algorithm:
She takes the ASCII code of each character, e.g. "GOLF" → \$[ 71, 79, 76, 70 ]\$
She ...
10
votes
11
answers
360
views
AoCG2021 Day 18: Stripping Strips
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2018 Day 3.
But you're not Bubbler, you're Lyxal! yeah, I know.
After a long period of chaos, ...
25
votes
7
answers
777
views
Stitch a hitomezashi pattern
Challenge
Given two binary vectors (containing two consistent values of your choice) of length \$n\$ and \$m\$, output a corresponding ascii-art hitomezashi stitching pattern.
You are to fill the ...
8
votes
14
answers
699
views
Get all binary between a binary string and its reverse
Your Challenge is to take a binary string as input and get all binary numbers between itself and the reverse of its string representation (the reverse may be less than or greater than the original ...
20
votes
34
answers
2k
views
Return all letter counts as an integer
Definition
Given some string return an integer whose digits are the number ocurrences of a-z (case insensitive, in alphabetical order) in that string. Any character with 0 instances is skipped. ...
11
votes
3
answers
283
views
Is it a valid line in "Girls & Boys"?
Intro
Blur's song Girls & Boys featured the lines
girls who are boys who like boys to be girls
who do boys like they're girls, who do girls like they're boys
...
13
votes
16
answers
889
views
AoCG2021 Day 11: Garbageful streams
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2017 Day 9.
Weekends are Bubbler's days off from posting these lol
A large stream blocks your path. ...
-8
votes
12
answers
351
views
Joe Mama or Joe Biden [duplicate]
Your task
Randomly pick and print "Joe Mama" or "Joe Biden" in as little bytes as possible.
Rules
No trailing lines, spaces, or anything else weird like that
No election fraud! ...
24
votes
29
answers
3k
views
AoCG2021 Day 2: Naughty or nice?
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2015 Day 5, Part 2.
Santa needs help figuring out which strings in his text file are naughty ...
25
votes
36
answers
3k
views
Randomly capitalize half of a string
Given string s of even length as input, randomly capitalize exactly half of the letters.
You can assume the input will always be a non-zero, even length
You can ...
30
votes
38
answers
3k
views
Bubbler and 3 others are typing․․․
Task
Implement a kind of "some users are typing" system, which can be found in Discord and some other chat clients.
If 1 user (say, Bubbler) is typing, output ...
27
votes
24
answers
2k
views
Convert prefix to infix
Infix notation is a method of printing mathematical expressions where each operator sits between its two arguments, such as \$ \left(5 \cdot 4\right) + 3 \$.
Prefix notation is a method of printing ...
14
votes
9
answers
1k
views
Convert Regex to Mask
From my CMC.
Given a regex and a non-empty printable ASCII text, return one bit per character in the text, indicating the positions of beginnings of non-overlapping matches, and also the positions of ...
29
votes
31
answers
3k
views
Open or Close the Parentheses
Every phone needs a calculator app. Because of the limited screen real estate, the developer of mine has decided to save some buttons. Instead of having two dedicated bracket buttons - one for open <...
20
votes
15
answers
5k
views
Write a Stack Exchange compliant brainfuck explainer
You are to take a string representing a piece of brainfuck code and Explanations, containing only printable ASCII characters and newlines ( to ...
19
votes
21
answers
2k
views
Alienese cycles
Alienese refers to two "languages" in the show Futurama. In actuality, they are two ciphers of English text with a pictographic alphabet. The first is a simple substitution cipher, but the ...
19
votes
19
answers
3k
views
Make a Scrabble Word Finder
Yes, I know there is a similar question, but this one specifically concerns any possible words, even with letters left over, while the linked one restricts to a permutation of the input
Objective
...
6
votes
2
answers
647
views
Bigram frequencies in text
Introduction
This challenge is about producing a code to count the frequency of bigrams in a text. A bigram is two consecutive letters in a text. For instance 'aabbcd' contains the bigrams aa, ab, bb, ...
19
votes
15
answers
2k
views
Is it a prefix normal word?
Prefix normal words arise in the context of binary jumbled pattern matching. A binary word \$w\$ consisting of \$0\$s and \$1\$s is said to be prefix normal * if, among all of its substrings, none ...
23
votes
1
answer
610
views
(t)h(e)(i)(r)(m)
Sometimes authors will write (s)he as a stand in for she or he and for some reason they don'...
19
votes
12
answers
2k
views
How many values of this type?
Background
The number of values for a given type is called the cardinality of that type, and that of type T is written as |T|.
Haskell and a few other languages ...
59
votes
47
answers
8k
views
Increment The Time
Every digital clock contains a small creature that has to advance the time every minute [citation needed]. Due to the popularty of digital clocks and the popularity of catching them in the wild, they ...
24
votes
20
answers
3k
views
Find the longest line
Given a string containing only the characters -, |, + and newline determine the longest ...
7
votes
8
answers
319
views
Encrypt this Message [duplicate]
Given a permutation of the alphabet and an input string, encrypt the input string by replacing all characters with the one's you've been given.
The capitalization should be kept the same and non-...
17
votes
17
answers
2k
views
Longest Uncommon Substring
For the purposes of this challenge a substring \$B\$ of some string \$A\$ is string such that it can be obtained by removing some number of characters (possibly zero) from the front and back of \$A\$. ...
18
votes
22
answers
2k
views
Parentheses Clusters
Write a program that groups a string into parentheses cluster. Each cluster should be balanced.
Examples :
...
-1
votes
1
answer
162
views
Find out your Ghost ghost name [duplicate]
Inspired by a tweet by Nathan W. Pyle
There is, now, a standard method of converting your boring, normal human name into a mysterious, ethereal Ghost Name™️. Ably described by Mr Pyle...
...
6
votes
16
answers
811
views
Written Word Equation
Word equations, but not as you know it! Given a sentence which will include two numbers, numerically, and a spelt operator, in the order seen in the examples, your goal is to give the numerical answer
...
8
votes
33
answers
3k
views
English An or A?
Given a string consisting of only upper and lower case letters, output an if it begins with a vowel, and a if not. For the ...
15
votes
8
answers
988
views
Simplify K projections
Background
K functions have a feature called projection, which is essentially partial application of values to a function. The syntax for projections is a natural extension of the regular function ...
12
votes
9
answers
1k
views
Implement a 2-tag system simulator
To quote http://brainfuck.org/utm.b:
A tag-system transforms strings over an alphabet A = {a[1], a[2], ... a[n], a[n+1]} as follows: a positive integer ...
16
votes
14
answers
2k
views
When's the Listening Party?
A listening party is an event where a bunch of people get together to listen to some music (like a viewing party, but for music). In the age of the internet you can do Listening Parties online with ...
14
votes
3
answers
582
views
Snap (card game)
When I was a child I used to play a variation of Snap to stake soccer trading cards.
"Game" is an overstatement because the only role of the players is to secretly prepare their starting ...
10
votes
5
answers
428
views
The Most Palindromy Code to Calculate Palindromy Numbers
The string
abaaba
Is a palindrome, meaning it doesn't change when it's reversed. However we can split it in half to make two palindromes
...