A competition to solve a particular problem through the usage and manipulation of strings.
21
votes
17answers
356 views
PKCS#7 padding validation
In cryptography, PKCS#7 padding is a padding scheme which adds a number of bytes N ≥ 1, where the value of each added byte is equal to N.
For example, Hello, World!, which has 13 bytes, is the ...
29
votes
53answers
4k views
This isn't rocket science
Write a program or function that takes in a single-line string. You can assume it only contains printable ASCII. Print or return a string of an ASCII art rocket such as
|
/_\
|E|
|a|
|r|
|t|
...
2
votes
0answers
63 views
Compact a list of numbers [duplicate]
Inspired by Using LaTeX to compact a list of numbers, this challenge is to output a compact list of numbers, given a range, as follows:
Input: 1,2, 3,4,5,8,11, 12,13
Output: 1-5, 8, 11-13
Input: 20,...
34
votes
44answers
3k views
Exploded view of a string
Don't you love those exploded-view diagrams in which a machine or object is taken apart into its smallest pieces?
Let's do that to a string!
The challenge
Write a program or function that
...
0
votes
0answers
66 views
sum integers to x with strings [on hold]
Generally computers are faster at working with numbers than strings. But when you think of problems in certain forms there might be a case for string processing algorithms for math. Is the problem ...
25
votes
6answers
365 views
Together Everyone Achieves More
(related: one, two, three)
An acrostic is a style of poem/writing where the beginning character of each line, when read vertically, also produces a word or message. For example,
Together
Everyone
...
2
votes
0answers
184 views
Where is your totem?
In the movie Inception we see the main star using a totem to check if he's in the real world or dreaming.
You seem to have misplaced your own totem, so you quickly draw inspiration from this movie ...
-1
votes
4answers
126 views
Can I take your order: a Chipotle concept conund
Challenge
Your program will take in a string from stdin, and output multiple lines to stdout.
An example of input looks like this:
My favorite Chipotle order:
B1113YNNY
Let's break it down:
...
15
votes
19answers
2k views
Text animation format Code Golf
Working with old files from DOS, I found an ancient text animation format, that specify how much time each frame must be shown in the screen. It's very simple:
F1W5F2W3
This example above ...
41
votes
37answers
6k views
Print every printable ASCII character without using it
In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.
For ...
25
votes
17answers
3k views
The Great Pyramid of ASCII
Introduction
It's 2600 BC and people are building pyramids now. They already made the basis of the pyramid but don't know how to continue. So, they called you for help.
The rules of making a pyramid ...
21
votes
10answers
3k views
Is this square symmetrical?
Write a program or function that takes in a 4×4 text grid consisting of exactly 4 A's, 4 B's, 4 C's, and 4 D's, such as:
ACDC
BBCA
BADD
ABCD
The ABCD's may be in any arrangement but there ...
2
votes
1answer
116 views
Check if input is permutation of source [duplicate]
Inspired by Input ∩ Source Code.
Task
Your task is to determine whether the input is a permutation of the source code.
Input
A string. Input is flexible; it should be able to handle the ...
10
votes
5answers
290 views
A047841: Autobiographical numbers
Definition
Here is the process to describe a number:
For each number from 0 to 9 that is present in the number:
Write down the frequency of that digit and then the digit.
For example, for the ...
20
votes
4answers
502 views
Identify a string from its substrings
Introduction
I've previously created two challenges where the idea is to reconstruct an object using as few query-type operations as possible; this will be the third.
The task
Your inputs shall be ...
8
votes
6answers
294 views
Print/Output all positive numbers in which every multi-digit substring in its decimal representation is also prime.
Task
Your task is to print or output all positive numbers in which every multi-digit substring in its decimal representation is also prime. If the number has at least 2 digits, this would imply that ...
53
votes
17answers
7k views
All in all it's just, uh, another trick in code golf
The purpose of this challenge is to produce an ASCII version of the cover of this great album by the rock band Pink Floyd.
The brick junctions are made of characters _ and |. Bricks have width 7 and ...
18
votes
39answers
2k views
Alphabet to number
Challenge
In this challenge you have to take a number as input and output the corresponding letter of the alphabet, and vice versa. (1 <=> A, 2 <=> B) etc.
1 -> A
2 -> B
...
26 -> Z
...
10
votes
2answers
195 views
Langford strings
Challenge description
A Langford string of order N is defined as follows:
The length of the string is equal to 2*N,
The string contains first N letters of the English alphabet, each letter ...
13
votes
13answers
561 views
Percent-Encode a String
Introduction
As some of you may know, URLs actually have a list of characters that do special things. For example, the / character separates parts of the URL, and the ?, &, and = characters are ...
28
votes
27answers
2k views
Wave-Particle Duality Laterally Programmatically
Write a program or function that takes in a nonempty single-line string. The string will either be zero or more spaces followed by one period (a particle), such as . or &...
17
votes
4answers
329 views
Minimal Word Search
Last week, we worked to create the shortest 1-D string using the top 10,000 words in the English language. Now, lets try the same challenge in 2D!
What you need to do is to take all of the above ...
41
votes
49answers
4k views
Random Golf of the Day #7: A distinctly random character
About the Series
This is a guest entry for the Random Golf of the Day series.
First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all....
25
votes
26answers
2k views
Make a (somewhat) self-referential string
You want to make a string where the (1-indexed) character at index n is n. When n is less than 10, this is easy: "123456789". When n is 12, for example, it becomes impossible, since numbers greater ...
37
votes
7answers
2k views
Fix my IPv4 address's missing periods
Sometimes when I'm typing out an IPv4 address, I get all the numbers right, but I forget to type one or more periods. I'd like to have a program (or function) that takes my broken IPv4 address and ...
6
votes
4answers
329 views
Fun with strings and string lengths
Introduction
Inspired by Dyalog Ltd.'s 2016 student competition. The challenge there is to write good APL code, but this is a code-golf and it is open to all languages. Derived from this closed ...
31
votes
11answers
2k views
Lemon-Limify a String
Write a program or function that takes in a nonempty single-line string. You may assume it only contains printable ASCII excluding space.
Print or return an ASCII art lozenge shape similar to a lemon ...
0
votes
1answer
129 views
Dyalog's International Problem Solving Competition (Phase I) – Code Golf Edition [closed]
Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. However, this is a multiple-holes (common theme is manipulation of data of any type and structure, ...
7
votes
7answers
451 views
Reduce and generalize a list of string
The goal of this challenge is to reduce a list of string to a shorter more general list of string.
Input
The Input is provided with space between the string (a b c) or in list form (["a","b", "c"]). ...
6
votes
10answers
3k views
Is it truthy or falsy?
There are so many different ways to express whether something is true or not! The goal of this challenge is to produce a standardized output of truthy or falsy for various input truthy and falsy ...
17
votes
4answers
470 views
I've been alphabet hunting for a while
Y'know, we've had a lot of "alphabet" challenges recently. (one two three four five.) While I love a good challenge, and those challenges were very fun, I think it's time for a change of pace. We need ...
35
votes
15answers
5k views
Be respectful in the restroom
Of course, the SE network is very knowledgeable about how to be respectful in the restroom, but for those of you who need a recap, being respectful means flushing the toilet, etc. Most importantly, ...
9
votes
8answers
337 views
Medieval orthography
Task
Your task is to convert a text into medieval orthography.
Details
j is converted to i and J to I.
u and U at the beginning of words are converted to v and V respectively.
v and V at anywhere ...
12
votes
35answers
1k views
A square of text
The Challenge
Given a string, output the text in the shape of a square.
You can assume that the text will always fit in a square, and that it will never be an empty string.
You can also assume it ...
0
votes
0answers
54 views
Codegolf - Generate an SHA-256 Hash of a String [duplicate]
Pretty simple. Create the smallest code (in bytes) that can generate an SHA-256 hash of a string (can accept input or use a defined string).
6
votes
3answers
151 views
Permute a string using Bit-Reversal
Previously, we computed the Bit-Reversal Permutation where we found how the order of indices would be permuted. In that case, we received an input n which was the order of the permutation of the ...
59
votes
20answers
7k views
Turtles All the Way Down
Write a program or function that takes in a positive integer and prints or returns a stack of that many ASCII-art turtles, where each turtle is larger than the one above it.
Specifically, if the ...
17
votes
17answers
2k views
Sort band names
Challenge description
You have a music library with many tracks recorded by many bands, each of which has a name, like Queen, Aerosmith, Sunny Day Real Estate, The Strokes . When an audio player ...
8
votes
1answer
169 views
Move platforms!
The Challenge
Given either a string, multiline string, or a two dimensional array, and a positive integer n, output the position of the platforms n turns after the
initial position.
U, D, R, L ...
11
votes
0answers
180 views
Lead Your Turtle by a String
Write a program or function that takes in a nonempty single-line string of printable ascii characters excluding space:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`...
27
votes
7answers
1k views
Compounding english
A compound word is a word that contains 2 or more words in it. We can do better than that, though. We need you to create 1 (nonsensical) word that contains every word.
However, we want this word to ...
7
votes
5answers
377 views
I misspelled my domayn name
According to Alexa rankings, the top 10 websites are:
google.com
youtube.com
facebook.com
baidu.com
yahoo.com
wikipedia.org
amazon.com
twitter.com
qq.com
google.co.in
Being the top 10 visited ...
11
votes
72answers
3k views
Snakes all around
Challenge
The challenge is simple: print a snake.
You will get the length of the snake as input.
A snake of length 2 looks like this:
==(:)-
A snake of length 7 looks like this:
=======(:)-
In ...
2
votes
5answers
223 views
“Break” a number [closed]
Origins
tl;dw (too lazy, didn't write): thought of it right before I fell asleep
Challenge
Breaking a number is defined as the following steps:
Take a number or a parseable data type as input ...
43
votes
75answers
7k views
Print a Tabula Recta!
Print a Tabula Recta!
The Tabula Recta (sometimes called a 'Vigenere Table'), was created by Johannes Trithemius, and has been used in several ciphers, including all variants of Bellaso's Vigenere ...
-4
votes
12answers
114 views
Random character from a string [closed]
Your goal in this code-golf is to pick a random character from a string. If a character appears X times, and there are Y characters, then the chance of that character being picked will be X/Y.
Input
...
26
votes
5answers
851 views
Patch the Paragraph
In the spirit of Patch the Image, here's a similar challenge but with text.
Challenge
Bit rot has afflicted your precious text! Given a paragraph composed of ASCII characters, with a rectangular ...
23
votes
4answers
468 views
Teach me how to add! [duplicate]
Everyone knows how to add numbers by hand, right?––Well, I hope so, but for anyone who needs a quick reminder:
To add 17282 and 1342, you proceed as follows:
place the larger (value wise, not ...
46
votes
21answers
4k views
Do X without Y
Usually, it is said that "Doing X without Y" can be a trap to beginners writing challenges (source). However, I am cocky and think that I can definitely make an X without any Ys. Randomly. Oh yes, ...
26
votes
21answers
3k views
Convert exponents into ASCII art
Task
Your task is to convert strings like this:
abc^d+ef^g + hijk^l - M^NO^P (Ag^+)
To strings like this:
d g l N P +
abc +ef + hijk - M O (Ag )
Which is an approximation to ...