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

learn more… | top users | synonyms

12
votes
4answers
225 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 ...
18
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
416 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 ...
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: ...
1
vote
6answers
276 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 ...
40
votes
22answers
4k 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, ...
30
votes
30answers
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, ...
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 ...
36
votes
20answers
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, ...
8
votes
4answers
221 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: ...
11
votes
1answer
231 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
423 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 ...
5
votes
1answer
267 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 ...
13
votes
1answer
729 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 ...
6
votes
9answers
434 views

Shift characters in a string

In this challenge, you are required to shift characters in an inputted string n number of times and output the shifted string Input Input will first contain a string. In the next line, an integer, ...
15
votes
2answers
314 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 ...
17
votes
12answers
893 views

Expand an encoded string

There's the classic run length encoding and decoding. input output a3b2c5 aaabbccccc And that's fairly straight forward and done before. The challenge is to also account for a non-standard ...
5
votes
9answers
580 views

Take first letter of each word, leave spaces and punctuation

Shrink each word in a string of group of strings to single letters delineated by spaces or punctuation. Example I'm a little teapot, short and stout. Here is my handle, here is my spout. When I get ...
1
vote
1answer
91 views

Gode-Colf: Wipping Flords around [duplicate]

Here is another short string related code-golf. You must write a full program that reads a string (from STDIN or as command line arguments, as long as you specify which) and wips the flords around ...
-5
votes
5answers
204 views

Return every N-th word of a string

Your goal is to write a program that, given a number N and a string as input, will return a string containing every Nth word of the original string, starting from the first word. Sample ...
19
votes
9answers
787 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 ...
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 ...
22
votes
22answers
2k views

Caesar equivalence

Two strings are "Caesar equivalent" if the distance (counting up) between the corresponding characters are the same. Yes, I made this term up. Here's an example: "Abc" and "Cde" are equivalent ...
6
votes
16answers
1k views

Stripping off extra spaces from a string

You are given a string. Output the string with one space per words. Challenge Input will be a string (not null or empty), surrounded with quotes(") sent via the stdin. Remove leading and trailing ...
11
votes
12answers
2k views

QuickGolf - Barry the messy developer #2

This is a follow-up of QuickGolf - Ignore the noise #1 the only problem being that Barry has made things even worse for us. Lets see what happened Update I've added code to create random ...
9
votes
7answers
341 views

Find the longest musical substring

A musical string is any string that can be played on a piano keyboard. For those of us who weren't forced to learn the piano as kids, here is what the keyboard looks like. So the string feed a ...
14
votes
14answers
2k views

QuickGolf - Ignore the noise #1

Instructions Barry is a not so good backend developer in charge of a small API that should give you information about purchases made in a client's shop. However, he hasn't done a great job and your ...
15
votes
12answers
784 views

Extract a string from a given string

You are given a string and two characters. You have to print the string between these characters from the string. Input Input will first contain a string (not empty or null). In the next line, there ...
9
votes
12answers
519 views

Mixing characters in a string

You have to write a function/program that takes input via the stdin/command-line arguments/function arguments, mixes up characters in a string, and then output the final string via the stdout. Input ...
12
votes
18answers
793 views

QuickGolf - Heads or Tails

Instructions Given an unknown input string i with a value of either heads or tails, return 1 for heads or -1 for tails with the shortest code. Sample not golfed code (55b): if(i == "heads"){ ...
8
votes
7answers
267 views

Detecting anagrams within a Parent String

Given two strings, a parent string and a query string respectively, your task is to determine how many times the query string, or an anagram of the query string; appears in the parent string, in a ...
18
votes
7answers
527 views

Optimize the Scralphabet

Scralphabet A normal bag of Scrabble tiles contains the following letters (? is a blank tile, which can stand for any other letter): ...
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 ...
32
votes
44answers
3k views

Capitalize first letter of each word of input

This is a relatively quick one, but I'm sure you'll like it. Codegolf a program that will take input in the form of a sentence and then provide the output with the first letter capitalized in each ...
7
votes
2answers
184 views

Non-crossing X's and crossing non-X's

You should write a program or function which given a text as input outputs or returns the sum of the following three integers: Number of lowercase x's which are not part of a cross-formation. Number ...
12
votes
3answers
933 views

Is that word Feminine or Masculine?

Write a program or function that takes in a single string containing only lowercase a-z, and prints or returns a truthy value if the word is the feminine version of the thing it represents and a falsy ...
23
votes
10answers
2k views

Where will your buddies sit?

You and some buddies are going bowling. There are a total of N bowlers. However, there are only N-1 chairs to sit in. The solution is simple: whoever's turn it currently is doesn't get a chair. Then ...
14
votes
5answers
524 views

Real-time string matching

Task The task is to golf a real-time exact string matching algorithm of your choice. Input Two lines of text supplied on standard input, separated by a new line. The first line contains the ...
15
votes
1answer
278 views

Find Patterns in Strings

In this challence, your task is to locate substrings with a given structure. Input Your input shall be two non-empty alphanumeric strings, a pattern p and a text t. The idea is that each character ...
42
votes
6answers
9k views

Hodorize a String

Hodor is a slow-minded but endearing character on the show Game of Thrones (he's in the books as well of course). The only word he ever says is 'hodor'. Surprisingly, despite not having much of a ...
9
votes
3answers
205 views

IMP: Implicit multiplication parser

Jack likes C programming language, but hates to write expressions like V=a*b*h; to multiply the values. He would like to write V=abh; instead, why should compiler moan about abh symbol being ...
11
votes
3answers
228 views

Wrap-Around Subsequences

Introduction In this challenge, your task is to find generalized subsequences of strings. The subsequences are not necessarily contiguous, and they can also "wrap around" the string, going past its ...
12
votes
2answers
261 views

ASCII L-system renderer

Background An L-system (or Lindenmayer system) is a parallel rewriting system that, among other things, can be easily used to model fractals. This question concerns deterministic, context-free ...
12
votes
8answers
867 views

Remove single line and multiline comments from string

Goal Using the programming language of your choice, write the shortest program to eliminate comments from a string representing a C program. Input The string can be... given as a function ...
2
votes
2answers
275 views

DoIt Java Style [closed]

Given string X, convert it to Java Style string, as defined below: Strings may only contain numbers and letters(signs are not allowed) Strings must not start with numbers Strings must start with ...
9
votes
1answer
283 views

Shortest Substring Index

I'm a lazy but efficient person, as many of you probably are as well. So, whenever I'm doing something I want to do it with minimal effort. Which is why I'm asking you to solve this problem for me. ...
4
votes
7answers
511 views

N-gram histogram

Given a text and a number N, output, in a human readable format, the set of the character N-grams with their respective percentages. The smallprint The text can be read from a file, stdin, passed ...
5
votes
11answers
592 views

Decode a Rövarspråket string

This question is the inverse of this one by James Williams. Rövarspråket Rövarspråket is a word game played by Swedish children, from the books about Kalle Blomkvist by Astrid Lindgren. The basic ...
10
votes
6answers
375 views

Implement a Variable Length Hash

My friend and I have this game that we play with words. It is a fun pastime and it involves "canceling out" letters in a word until there is nothing left. I am really tired of him being so much faster ...
13
votes
24answers
2k views

Convert a string to its Rövarspråket equivalent

Rövarspråket Rövarspråket is a word game played by Swedish children, from the books about Kalle Blomkvist by Astrid Lindgren. The basic rules are as follows (from Wikipedia): Every consonant ...