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

learn more… | top users | synonyms

5
votes
0answers
110 views

We Are Number One, but

Task Your task is to write a program that will take input, and then output the lyrics to We Are Number One, changing specific words. The input will contain both the words to be changed, and the ...
7
votes
1answer
359 views

Positional Awareness

Positional Awareness Your task is to generate a program that, for every permutation of its characters (which includes the original program), outputs the positions of every character relative to the ...
20
votes
12answers
3k views

bROKEN cAPSLOCK kEY fIASCO

bROKEN cAPSLOCK kEY fIASCO Some of your employees have broken capslock keys and you're too cheap to replace them. Help them out by creating the shortest program possible to correct their work! Simply ...
32
votes
33answers
3k views

Let's play tennis

I suddenly really want to play tennis, but alas I do not have a court! Surprise! This is where you come in. You have to print a tennis court for me, but you have to do it in the fewest bytes ...
12
votes
1answer
159 views

Read a crossword with a twist!

Similar to this question, but this is a crossword variation! Instead of only one letter per grid square, you can have one or two. Input: A 2d array, or whatever works in your language. You can ...
11
votes
6answers
369 views

Print a Singing Angel

Keeping with a festive theme, print a carol singing angel with the shortest possible code. The angel is raising money for the homeless, so must be able to sing all three of the below songs available ...
12
votes
6answers
827 views

Pen Pineapple Apple Pen… with your own pens, pineapples and apples

Prelude: This challenge is different from "another cat program". There's literal tons of different twists, why can't I have my own, people? Unique things: It isn't reading direct input to output. ...
18
votes
10answers
730 views

Repeat after me!

Given a string as argument, output the length of the longest(s) non-overlapping repeated substring(s) or zero if there is no such string. You can assume the input string is not empty. Examples ...
46
votes
33answers
1k views

Appending String Lengths

Challenge: Given a string s on the characters a-z, A-Z, 0-9, append the length of s to itself, counting the additional character(s) in the length as part of the total length of s. Input: Just a ...
7
votes
6answers
319 views

This cat has bugs? Really?

Challenge: Read input (within visible ASCII range) and output with a few modifications: In each set of 10 characters of the input randomly (50/50): replace one character* (with a random** one ...
33
votes
24answers
2k views

Un-de-duplicating strings

Introduction Let's observe the following string: AABBCCDDEFFGG You can see that every letter has been duplicated, except for the letter E. That means that the letter E has been de-duplicated. So, ...
17
votes
15answers
2k views

Significant Whitespace: Robbers

This is part of a Cops and Robbers challenge. Go here for the cops' part. For the purpose of this challenge, we'll define whitespace as only linefeeds (0x0A) and spaces (0x20). Note that most ...
47
votes
24answers
4k views

Significant Whitespace: Cops

For the purpose of this challenge, we'll define whitespace as only linefeeds (0x0A) and spaces (0x20). Note that most languages and regex flavours consider many other characters as whitespace as well, ...
7
votes
1answer
368 views

2D Dungeon Crawler

Your program has to take a multi-lined string, like this: ############# # # # p # # # ############# p is the player and # is a block. Now under that in the terminal ...
16
votes
2answers
288 views

Roll cake phrases

Roll cakes are delicious sweets made with a layer of sponge cake, a layer of cream (or icecream), rolled as a spiral, see Wikipedia. Your task is to get a non-empty phrase string from standard input, ...
12
votes
1answer
530 views

Bob's Passwords

Introduction Bob likes to have different passwords for each website he uses. He wants passwords in a special format so that he can remember. Help him by building a password generator which is as ...
6
votes
4answers
201 views

Equal out bracket types

Based on THIS question. Given a string, replace each bracket ()[]{}<> with a bracket of the appropriate type so that the brackets match, and the nested brackets cycle as follows: Outermost ...
27
votes
19answers
2k views

URL-Friendly Titles

People on this site really love to embellish their post titles... Stewie's sequence: + * - / + * - / However, when this title needs to be included in the page URL, it is simplified: stewies-...
27
votes
13answers
1k views

Output the HTML colors

The 16-color CGA palette (also known as the HTML colors) is a set of 16 colors used by early graphics adapters. The goal of this challenge is to output all 16 of them, in hex format (RRGGBB), in ...
25
votes
25answers
3k views

Please release me!

As code-golfers, we're not used to releasing (surely). We're gonna need a few tools to help us do that. Of course, to help marketing a new release, we need a nice and shiny Release Version. Who doesn'...
20
votes
20answers
1k views

Interleave strings

Inspiration.* I cannot believe we have not had this challenge before: Task Given one or more printable ASCII strings, interleave them by taking one character from each string, cyclically until out ...
27
votes
21answers
3k views

Dutch Burgerservicenummer (BSN) eleven-test

Introduction: A Dutch BSN (Burgerservicenummer) is valid when it complies to the following rules: It only contains digits. The length should be either 8 or 9 in length. When the digits are indexed ...
17
votes
4answers
294 views

Generate me a QFP chip!

Generate me a QFP chip! From the sandbox! QFP is a type of form factor for an electrical component where pins come out the sides of a chip. Here are is a picture of a typical QFP component: you ...
8
votes
1answer
212 views

Is it an emoji? [closed]

I've been working on this iOS app recently and I encountered a (rather easily solved) problem: How do I determine if my string is comprised only of emojis? Well, that's your job today! Input A ...
9
votes
3answers
284 views

Find the shortest pangrams from a word list

A pangram is a string that contains every letter a-z of the English alphabet, case-insensitive. (It's OK if the pangram contains more than one copy of a letter, or if it contains non-letter characters ...
48
votes
15answers
3k views

Tasteless and other bugs

Some versions of the standard Android calculator app allow you to press a key, like 'sin' and then the 'del' key to make it 'si'. Probably just a bug which they can't be bothered with removing. The ...
12
votes
4answers
375 views

Help me untangle these wires!

My wires are all tangled! Isn't it annoying when wires get all tangled up? Well, that just happened to me, so I'd like to to help me untangle them! For your convenience, I've disconnected them all ...
5
votes
9answers
370 views

Parse a raw IRC message

In the IRC protocol, raw messages look similar to this: command arg1 arg2 :arg3 with spaces :arg4 with spaces :arg5 In a shell environment (e.g. bash), that would be equivalent to: command arg1 ...
9
votes
4answers
239 views

Aircraft Marshalling School

Given a string representing a series of aircraft marshalling hand signals, write a function or program to calculate the final position of an aircraft following these signals. N.B.: Co-ordinates in ...
9
votes
2answers
133 views

Compute the height of a radix tree

Introduction A radix tree, also known as compressed trie or compressed prefix tree, is a tree-like data structure for storing a set of strings. The edges of the tree are labeled by nonempty strings, ...
11
votes
4answers
204 views

Bouncey-edged XY box with a marker at Z

Long time lurker first time poster here. Write a program which takes 3 inputs: X, Y and Z. X = across (columns) Y = down (rows) Z = Location Marker The program should then print a visual grid X ...
-3
votes
2answers
234 views

Checking String for enum in Java

Write a Java method to check if a given string matches any value in a given enum. Your method will take two parameters, one a string and one an enum, and return True if the string representation of ...
19
votes
22answers
2k views

Magic popcount numbers

There’s a famous tricky algorithm for counting the number of set bits in a 32-bit unsigned integer: int popcount(unsigned x) { x = (x & 0x55555555) + ((x >> 1) & 0x55555555); x = (...
16
votes
2answers
161 views

Overlapping Line Ordering

(Inspired while drawing on a dry erase board) Challenge: Given an input string containing characters that represent different colors of dry erase markers on a white board, output the order in which ...
12
votes
7answers
425 views

Building Demolition

Challenge Write a full program/function to Demolish a given building at the rate 1 floor per second. INPUT Input is a building through STDIN(or whatever is called in your language) or through an ...
15
votes
19answers
1k views

Hiccup a string

Your challenge is to write a program or function that hiccups a string. It should take a string as input (via any standard method), then follow these steps: Generate a (not necessarily uniformly) ...
10
votes
4answers
357 views

C.U.S.R.S - The Completely Useless String Refactoring System!

Introduction I'm a real big fan of the SBU (Short But Unique) challenges that crop up on PPCG all of the time. The CUSRS is a system designed to refactor strings, a CUSRS function takes 2 parameters ...
9
votes
5answers
259 views

That's one odd mountain!

Inspired by Display a chain of little mountains with an odd number on the top of it! by @sygmei. Why have a chain of mountains when you can have one massive one? Make a program that takes an input ...
19
votes
30answers
3k views

Display a chain of little mountains with an odd number on the top of it!

First line is made with ceil(n/2) elements where each element is: <space><odd-number><space> Second line is made with ceil(n/2) elements, but each element is / \ only. You may ...
7
votes
6answers
297 views

Get a word's individuality!

I love /usr/share/dict/words; it's so handy! I use it for all my programs, whenever I can! You're going to take advantage of this ever so useful file to use, by testing a word's individuality. Input ...
9
votes
4answers
236 views

Abstract Syntax Tree Golfing: FizzBuzz, Python

Summary Implement FizzBuzz in Python, with the fewest possible tokens. Challenge Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” ...
14
votes
21answers
2k views

Generate a cipher

Generate a cipher given a number and string Your task is simple. Given a string s and a number 0 <= n <= 9 as inputs, insert a pseudo-random printable ASCII character between each character of ...
53
votes
25answers
6k views

Cracking in progress

Remember those brute-force programs to crack password that show every combination they are trying? More precisely, at one point, the n first characters are fixed (they have been guessed successfully), ...
23
votes
6answers
1k views

Efficient Typing on a Gameboy

Many old Gameboy games often required string input from the user. However, there was no keyboard. This was handled by presenting the user with a "keyboard screen" like so: The 'character pointer' ...
-5
votes
3answers
111 views

Substring Substitution

Challenge Implement a program that given three strings a, b, and c, substitutes all instances of the substring b in a with c. In other words, implement Ruby's String#gsub with strings instead of ...
67
votes
40answers
11k views

Make a “Ceeeeeeee” program

Once I wrote a JavaScript program that would take as input a string and a character and would remove all characters except for the first one and the character given as input, one by one. For example, ...
9
votes
20answers
725 views

Animate finding the middle

Given a non-empty string, keep removing the first and last characters until you get to one or two characters. For example, if the string was abcde, your program should print: abcde bcd c However,...
20
votes
2answers
477 views

On this site we obey the laws of thermodynamics!

And in particular the second law: the entropy of an isolated system increases over time. For this challenge, An "isolated system" will be taken to be a program or function (abbreviated as "program" ...
27
votes
19answers
3k views

Head, Shoulders, Knees and Toes, Knees and Toes

Introduction: I think we all know it, and it has probably been translated in loads of different languages: the "Head, Shoulders, Knees and Toes" children song: Head, shoulders, knees and toes, ...
20
votes
6answers
1k views

Magic mirror madness

Introduction I have a room full of magic mirrors. They are mysterious artifacts that can duplicate any item, except another magic mirror. More explicitly, a duplicate version of the item will appear ...