A competition to solve a particular problem through the usage and manipulation of strings.

learn more… | top users | synonyms

-1
votes
3answers
51 views

Is 7 l8r than 9? (Is seven later than nine?)

This is a fairly simple code golf challenge. Your program, given an ASCII string, is to parse that string into two strings, which it will evaluate. If the second string is "later" than the first one, ...
41
votes
23answers
5k views

First code golf decathlon

Tasks All competitors try to solve the following list of 10 tasks: math Read a positive integer n from input and return the sum of the cubes of the first n non-negative integers. For input 1, ...
28
votes
29answers
3k views

Chunky vs. Smooth Strings

Consider a string of length N, such as Peanut Butter with N = 13. Notice that there are N-1 pairs of neighboring characters in the string. For Peanut Butter, the first of the 12 pairs is Pe, the ...
20
votes
18answers
2k views

Swap capitalization of two strings

your shift key is broken. wheNever you type two lines, the cApitaL LetteRs in them get swappeD. you must write a program to fiX THIS! Description The input is two strings, s1 and s2, equal in ...
41
votes
14answers
4k views

A code golf challenge, m'kay

Mr. Mackey is a South Park character well-known for adding "m'kay" in everything he says. Write a program or function that transforms a string of text into something Mr. Mackey would say. M'kay ...
25
votes
10answers
2k views

Sinusoidal text

Goal: Write a program or function which prints an input string in a sinusoidal shape. The ASCII sinusoid Here is one period of the sinusoid: ....... ...
2
votes
6answers
312 views

How many contiguous “strings” can you find in a set of strings?

Consider the set of 16-character strings containing only the 95 printable ASCII characters. There are 9516 ≈ 4.4×1031 such strings. Imagine these strings are put into a list and sorted ...
13
votes
8answers
764 views

Alphabetic Fannkuch

Fannkuch is a classic benchmark program. The name comes from the German "Pfannkuchen"- pancakes- for the algorithm's resemblance to flipping stacks of pancakes. A Fannkuch sequence of numbers is ...
43
votes
7answers
2k views

Make the Stretchy Snakes Kiss

A stretchy snake looks something like this: <||=|||:)~ Each separate sequence of vertical bars (|) in a stretchy snake, known as a stretchy portion, is individually extendable to twice its ...
14
votes
21answers
1k views

Calculate average characters of string

Task Your task is to produce string that contains average characters of string. First character of result would be average character of first character (which is first character) and second character ...
6
votes
0answers
138 views

Fastest Longest Common Subsequence Finder

Your task is to solve the Longest Common Subsequence problem for n strings of length 1000. A valid solution to the LCS problem for two or more strings S1, … Sn is any string T of maximal ...
19
votes
3answers
325 views

Accentuated abjad English (ōcćnt̮ōt̖d ōbj̄d óngḷsh)

An Abjad is a writing system where each symbol stands for a consonant, and where vowels are omitted. An impure Abjad is an abjad in which there are additionals symbols for vowels, usually diactrics. ...
36
votes
17answers
3k views

Garlandification

Garland Words A garland word is a word which can be strung together like a garland, because it ends with the same letters it starts with. These groups of letters can even overlap! For example, ...
71
votes
108answers
18k views

Sing Happy Birthday to your favourite programming language

Your favourite programming language has just had a birthday. Be nice and sing the Happy Birthday song to him (or her, if you will). Of course you should accomplish this by writing a program in that ...
38
votes
30answers
5k views

Backhanded^H^H^H^H^H^Hspaces

On some terminals, pressing backspace generates the control code ^H to delete the previous character. This gave rise to a snarky idiom where edits are feigned for comedic effect: Be nice to this ...
20
votes
5answers
767 views

Is it simple or is it hard?

For your hard thing to do, you must make a thing for a computer to do that finds out if some words are explained in a simple way. Something is explained in a simple way if it only uses the ten hundred ...
16
votes
6answers
379 views

Numbering Hierarchical Outlines

Write a program that takes in a string where every line consists of the character 0 indented by some number of spaces. The top line is not indented and every other line will be indented by at most one ...
18
votes
25answers
1k views

Remove common leading spaces

When coding in Python, sometimes you want a multiline string within a function, e.g. def f(): s = """\ Line 1 Line 2 Line 3""" (The backslash is to remove a leading newline) If you ...
9
votes
5answers
492 views

Shortest Longest Common Subsequence Code

Your task to to solve the SLCSC problem, which consists in finding the shortest possible code to solve the Longest Common Subsequence problem. A valid solution to the LCS problem for two or more ...
36
votes
21answers
4k views

Ninjas and Monkeys and Bears, Oh My!

This challenge is NinjaBearMonkey's prize for winning my Block Building Bot Flocks! challenge with the Black Knight submission. Congratulations NinjaBearMonkey! The challenge here is fairly simple, ...
13
votes
4answers
245 views

Implement bzip2's run-length encoding

Background After applying the BWT (as seen in Burrows, Wheeler and Back) and the MTF (as seen in Move to the printable ASCII front), the bzip2 compressor applies a rather unique form of run-length ...
51
votes
31answers
14k views

All Your Base Are Belong To Us (Restricted)

Input must not be required, and output must read "All your base are belong to us". Restrictions No external resources. Plus a minimum of two of the following: You cannot use "a", "b", "t", "u", or ...
17
votes
29answers
2k views

The n-th Ternary

I define the n-th ternary as a ternary that returns n and has the form: 1 ? 2 ? 3 ? n - 1 ? n : 0 : 0 : 0 # n - 1 zeroes Write a function or complete program that given an input n will output or ...
10
votes
10answers
517 views

Decimal Time of Day Conversion

Introduction Time is confusing. Sixty seconds to a minute, sixty minutes to an hour, twenty-four hours to a day (and not to mention that pesky am/pm!). There's no room for such silliness nowadays, ...
32
votes
33answers
3k views

Stretching Words

Write a program or function that duplicates letters in a word, so that all the duplicated letters arranged from left to right in the word would form the input array. For example: input: chameleon, ...
6
votes
4answers
727 views

Necklace stones puzzle

Given a necklace with color stones (yellow, white, brown, etc.) of at least two different colors, we describe that necklace using letters that correspond to each color, choosing an arbitrary starting ...
32
votes
14answers
3k views

Staircase writing

Write a program or a function that will output a given string in a staircase fashion, writing each part of a word that starts with a vowel one line below the previous part. For example: Input: ...
18
votes
7answers
567 views

Move to the printable ASCII front

Background The move-to-front transform (MTF) is a data encoding algorithm designed to improve the performance of entropy encoding techniques. In the bzip2 compression algorithm, it is applied after ...
22
votes
42answers
3k views

Convert C header names to C++ header names

In the C standard library, header names end with a .h suffix: stdio.h In C++, those header names are available in an alternative form, with a c prefix instead: cstdio Write a function that ...
20
votes
16answers
2k views

Write a program that finds the most occurring paired letter in a string

The program must output the letter that is paired the most. For example, if your program was given the following string: "Sally's friend Bobby searched for seashells." it must output L because "ll" ...
10
votes
6answers
481 views

Print an ascii spiral in O(log n) memory

You may write a program or function that receives an odd, positive integer n, where n >= 3, as either a function argument, command line arguments, or on STDIN (or equivalent for your system), and ...
17
votes
14answers
1k views

Topographic Strings

Here is some example input, so I can explain what the problem is: ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) Think of this line of text as a topographic map of some mountains. Each set of ...
13
votes
1answer
758 views

Rearranging Words

You should write a program which receives two strings as input and outputs a sequence of movements which rearrange the first string into the second. You should use as few moves as you can. Both ...
15
votes
3answers
686 views

How many characters per character?

At http://shakespeare.mit.edu/ you can find the full text of each of Shakespeare's plays on one page (e.g. Hamlet). Write a script that takes in the url of a play from stdin, such as ...
1
vote
6answers
289 views

Number of characters in an integer's name [duplicate]

The goal of this challenge is to show how many characters are in the name of a given integer. This is code golf, so the smallest code wins. RULES The input will be between 0 and 100 (inclusive). If ...
18
votes
23answers
2k views

Counter counter

In typography, a counter is the area of a letter that is entirely or partially enclosed by a letter form or a symbol. A closed counter is a counter that is entirely enclosed by a letter form or ...
38
votes
25answers
3k views

Fake Marquee Text

In this challenge fake marquee text is text that is shown part by part, in a scrolling-like fashion. Some examples: testing 4 t te tes test esti stin ting ing ng g hello 2 h he el ll lo o ...
22
votes
33answers
3k views

Generating a single string with an Oxford comma from a list

What are some clever (brief and idiomatic) approaches to taking a list of strings and returning a single properly punctuated string built from the list, with each element quoted. This came up for me ...
12
votes
28answers
2k views

Count the number of vowels in each word of a string

This is a rather easy challenge. Challenge Input will contain a string (not null or empty) of maximum length 100. Output the number of vowels in each word of the string, seperated by spaces. Rules ...
20
votes
9answers
803 views

Formatting a Lisp-like Syntax

Background (Based on a true, heart-wrenching story) In my time, I've played around with Lisp and similar languages often. I've written with them, ran them, interpreted them, designed them, and made ...
8
votes
0answers
1k views

Longest common substring

This challenge is about writing code to solve the following problem. Given two strings A and B, your code should output the start and end indices of a substring of A with the following properties. ...
24
votes
9answers
2k views

Word Search Puzzle

Given a rectangular text as a word search puzzle and a search string, determine if the text contains the search string. The search string may appear: horizontally, vertically or diagonally forwards ...
20
votes
7answers
793 views

A Basic Pyth-like Syntax Checker

Pyth is a golfing language based on Python. It uses prefix notation, with each command having a different arity (number of arguments it accepts). Your task is to write a syntax checker for a ...
8
votes
4answers
223 views

Compute minimal string segment sizes

A common optimization to save space in binaries is to merge string literals where one literal is the suffix of another. For instance, a binary with the string literals a: foobar b: bar c: barbaz d: ...
5
votes
1answer
271 views

Create a basic autocorrecting spell checker

In this challenge, you have to implement a basic spell checker and autocorrector. Your program will use the first input as a source for a dictionary of words, and will use that to autocorrect the ...
11
votes
1answer
239 views

Each step of the Levenshtein distance

In this challenge you will write a program that takes two newline-separated strings, s1 (the first line) and s2 (the second line), as input (STDIN or closest). You can assume that the length of s1 ...
13
votes
3answers
451 views

Burrows, Wheeler and Back

Background The Burrows–Wheeler transform (BWT) is a reversible permutation of the characters of a string that results in large runs of similar characters for certain types of strings such as plain ...
40
votes
6answers
2k views

Language Design: 2-D Pattern Matching

This is Fortnightly Challenge #6. Theme: Language Design There's a chatroom for this challenge. Come and join us if you want to discuss ideas! And now for something completely different... This ...
52
votes
79answers
10k views

Print the alphabet without using each vowel

Inspiration: in 1939, a man named Ernest Vincent Wright wrote a novel called Gadsby without using the letter 'e'. Your task is to write a set of (up to 5) programs in any language (which has a ...
15
votes
2answers
323 views

Fix the Braces, etc

Your mission, should you choose to accept it, is to add the minimum number of parentheses, braces, and brackets to make a given string (containing only parentheses, braces, and brackets) have correct ...