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

learn more… | top users | synonyms

8
votes
3answers
280 views

Write a Magic Spellchecker

The game Waving Hands is somewhere between a pen-and-paper Magic: the Gathering and a very elaborate Rock Paper Scissors. Each turn you write down one of eight gestures for each hand: wiggled ...
28
votes
8answers
1k views

Reverse indentation

I've heard that your code can run faster if you indent it in reverse, so that the compiler can process it like a tree design pattern from the very top of the "branches" down. This helps because ...
17
votes
5answers
943 views

Caesar-Cypher-Mania

The Caesar Cypher is a very simple substitution cypher where each letter is shifted by a fixed offset (looping around Z to A). Similarly, we can also a Caesar cypher for the set of printable ASCII ...
40
votes
19answers
4k views

Significant Whitespace

We define whitespace to be any of the three characters, tab (0x09), newline (0x0A) or space (0x20). For this challenge, you're to write two programs or functions in the same programming language, ...
14
votes
3answers
1k views

Distinguish between Masculine and Feminine Nouns in French within 100 characters

You are to write a very small program within 100 characters. Your program must distinguish between masculine and feminine french nouns. The output should be un if it is masculine and une if it is ...
9
votes
2answers
351 views

Concatenate Strings with Context

Strings with Context For the purposes of this challenge, a string with context is a triple of strings, called the left context, the data part, and the right context. It represents a substring of a ...
7
votes
2answers
299 views

Cyclically Equivalent Words

Cyclic Equivalence Let L be a list of pairs of letters, for example [(a,b), (a,c)]. We call L a list of commutators. Two words are cyclically equivalent over L, if one can be transformed into the ...
51
votes
77answers
9k 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 ...
11
votes
5answers
357 views

Generalized Gematria Calculator

Create a bidirectional Gematria calculator, for any given sequence of Unicode characters as the alphabet. Gematri-What? Gematria is a system of assigning numerical values to symbols, developed by ...
11
votes
16answers
2k views

Sum of strings without converting

You have to take 2 string inputs and output the sum of these two strings without converting them to int or using any numeric data type. ex. string one = "123"; string two = "456"; string sum = ...
37
votes
7answers
3k views

Avoiding Rivers

Background In typography, rivers are visual gaps in a block of text, which occur due to coincidental alignment of spaces. These are particularly annoying since your brain seems to pick them up more ...
19
votes
38answers
4k views

Answer to life, the universe, and everything

Post the shortest code possible that will output 42 only if the input is: abbcccddddeeeee ... zzzzzzzzzzzzzzzzzzzzzzzzzz
40
votes
2answers
3k views

Regex that only matches itself

There are some pretty cool challenges out there involving regex (Self-matching regex, Regex validating regex) This may well be impossible, but is there a regex that will ONLY match itself? NOTE, ...
8
votes
6answers
1k views

Interpret /// (pronounced 'slashes')

Because we can't get enough of esoteric language golfs, can we? ///—pronounced slashes—is a fun little language based on the s/// regex-replacement function of Perl fame. It contains only ...
38
votes
51answers
4k views

How to randomize letters in a word

According to some controversial story, the odrer of ltteres in a wrod deos not mttaer much for raednig, as lnog as the frist and lsat lteter macth with the orignial wrod. So, for fun, what would be ...
1
vote
25answers
1k views

Count how many characters are in the program's source

Write a program that counts and prints the number of characters in it's own source code to standard output. The number must be generated from counting the characters. This Ruby solution would not be ...
35
votes
23answers
5k views

Draw the Sawtooth Alphabet

A simple one today. Write the shortest program that draws a "sawtooth alphabet" given a positive integer for the height. You must write the name of your programming language when you come to the ...
62
votes
93answers
15k 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 ...
3
votes
4answers
462 views

Find imperfect anagrams

The goal of this challenge is to write a program which takes a string (of any length) as input and displays anagrams (see these examples of anagrams) of this string, made by taking words in a ...
18
votes
7answers
1k views

Reassuring parables

Quite a few people here are probably avid XKCD readers. So, I figure I'd challenge you guys to do something that Megan can do easily: make a script that generates thousands of reassuring parables ...
7
votes
8answers
824 views

Practical Golf - US States [closed]

My family has an e-commerce business. On our own site, we force people to choose their state from a dropdown menu when they enter their address, but through some other channels we use, customers can ...
15
votes
36answers
1k views

Shortest program to split a string at non-digits without RegExps

EDIT: If you're using Lisp, I have given some guidelines at the bottom in counting bytes. Objective: Make the shortest function that splits a string at non-digits and returns an array consisting of ...
10
votes
24answers
2k views

Print a string with vertical words

Your task is to take an input string of ascii characters and output the string as a series of vertical words separated by spaces. An example is shown below: Given the string: Hello, World! My name ...
19
votes
32answers
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 ...
11
votes
19answers
3k views

Increment every number in a string

Given a string containing decimal numbers: teststring134this 123test string54 100 increment every number in this string by one to give the new string teststring135this 124test string55 101. The ...
7
votes
8answers
1k views

Write an IBAN validator

Write a program (the body of the function is enough) that accepts a string of alphanumeric characters and validates it according to ISO 13616:2007. The algorithm for validation is (source: wikipedia ...
2
votes
3answers
339 views

Let's play countdown!

For those of you who have seen the popular daytime TV show Countdown, you will know that the contestants are given 9 randomly selected letters and must then find the longest word they can in 30 ...
16
votes
28answers
1k views

Convert a string of binary characters to the ASCII equivalents

Take a string of binary characters separated by a space, and convert it to an ASCII string. For example... 1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100 ...
15
votes
18answers
2k views

Capitalize String

Given a string, capitalize it. By capitalization I mean conTeNT-lENgth changes to Content-Length. In the example I showed the string with 2 words with - as the word boundary. However I expect you to ...
7
votes
4answers
327 views

Line numbering - implement nl

Your task is to implement a program similar to the nl command-line tool from the GNU core utilities. Standard loopholes are banned. You may not use any built-in or external function, program or ...
5
votes
6answers
495 views

Find all strings at distance k

The edit (or Levenshtein) distance between two strings is the minimal number of single character insertions, deletions and substitutions needed to transform one string into the other. The challenge ...
32
votes
38answers
6k views

The shortest code to invert a binary string

Me thinks there aren't enough easy questions on here that beginners can attempt! The challenge: Given a random input string of 1's and 0's such as: 10101110101010010100010001010110101001010 Write ...
13
votes
30answers
2k views

Reverse stdin and place on stdout

Requirements: Take an input on stdin including new lines / carriage returns of unlimited length (only bounded by system memory; that is, there is no inherent limit in the program.) Output the ...
8
votes
2answers
282 views

Rosetta Stone Challenge: Run-Length Encoding v2.0

The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! The Challenge We've done run-length encoding before but only ...
7
votes
3answers
895 views

Restricted memory optimization

The edit (or Levenshtein) distance between two strings is the minimal number of single character insertions, deletions and substitutions needed to transform one string into the other. If the two ...
23
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 ...
30
votes
14answers
3k views

String.prototype.isRepeated

UPDATE : isaacg's Pyth submission is the winner! Many of you must have heard that there is a cooler version of JavaScript in town (read ES6) which has a method String.prototype.repeat so that you ...
13
votes
1answer
339 views

Minimal Boggle-like Arrangements

Consider how a word could be arranged on an arbitrarily large Boggle grid if the rule about not using the same letter cube more than once is ignored. Also assume that you have an unlimited number of ...
5
votes
0answers
194 views

Which positive integer is equal to it's own Scrabble score when spelt out in full? [closed]

The Challenge: Make the shortest program to confirm that 12 is the answer. (The puzzle is from Ian Stewart's "Cabinet of Mathematical Curiosities". This is my first code golf question. I hope this ...
-4
votes
2answers
458 views

Strings: Microsoft interview

You are given an array of strings , you have to construct a single array containing all of them so that the same array of strings can be reconstructed from the large array. The strings may contain any ...
19
votes
17answers
2k views

How many IP addresses are in a given range?

Inspired by... Networking - How can I work out how many IP addresses there are in a given range? Write a program or function that takes two strings as input, each being an IPv4 address ...
10
votes
10answers
876 views

Quoting Big Brother

Task: Have your program randomly choose one of the following two quotes at runtime and print that one quote, exactly as shown. 1: Under the spreading chestnut tree I sold you and you sold me. There ...
10
votes
3answers
449 views

Decompose words into other words (e.g., “afterglow” = “aft” + “erg” + “low”)

Here's one for all you wordsmiths out there! Write a program or function which takes a list of words and produces a list of all possible concatenative decompositions for each word. For example: ...
6
votes
45answers
2k views

Input a number and return day of week

Not restricted to any one programming language. What I'm saying is you pass 1 to it and it returns Monday, 7 corresponds with sunday and so on. I've managed a 146 byte statement in Java to do the ...
2
votes
15answers
847 views

Concise case changing code

Create the shortest program that given an input string it outputs the opposite-cased string. For example if I pass the string "HeLlO" the program should output "hElLo". Of course, neither aggregate ...
4
votes
2answers
300 views

Put together cut strips of paper to get original message

This question is from a programming challenge (not DARPA) which has ended. A sheet of paper consists of message, which has been shredded into vertical strips. Given the vertical strips and a ...
7
votes
4answers
546 views

The Forest Path

After your disastrous canoe ride, you ended up falling off a waterfall at the end of the river rapids. Your canoe exploded, but you managed to survive the explosion. However, your river journey went ...
13
votes
4answers
691 views

Write a program which replaces with spaces the braces in cases where braces in places cause stasis

You are a project manager. One day, one of your programmers went insane (not your fault) and took all the expressions in the codebase and added random brackets to them, before quitting on the spot, ...
10
votes
7answers
541 views

Molar masses of compounds

Task Write a program that takes in a compound made solely of elements with an atomic number less than or equal to 92 (Uranium), and outputs the molar mass of the compound in grams/mole. Rules and ...
12
votes
3answers
757 views

Expression that equals its length

Given a number, find an expression in words equaling that number, with a length of that number. Thus, to an input of 15, you might output sixteen minus one, which has fifteen characters (not counting ...