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

learn more… | top users | synonyms

8
votes
0answers
51 views

What's being surrounded

I've always wanted to surround some text with #s, but I have trouble figuring out what I surrounded so in this challenge you'll be writing a program to do just that Examples Input / Outputs are ...
10
votes
7answers
273 views

“Stair-ify” a string

You must write a program or function that creates a "stair-ified" string. Here is how you "stair-ify" a string: For each character in the string: If the character is an upper or lowercase vowel, ...
9
votes
8answers
444 views

Split string into n pieces (or pieces of length n)

The Challenge In this challenge you have to do two different (but related) tasks depending of the order of the input. Your program will recieve a string s and an integer n as input and will split s ...
14
votes
6answers
274 views

Insert semi-sorted into unsorted array

Welcome to your first day at PPCG Inc. As our newest junior assistant document sorter, you are responsible for making sure all documents we sent down to you are archived in alphabetical order. It's so ...
7
votes
2answers
111 views

Is the path correct?

Is the path correct ? Given a string, your program must determine whether or not Alice can reach Bob, following the signs on the map. You must return a truthy or falsy value. The input string will ...
36
votes
10answers
3k views

De-Snakify a String

A regular string looks like this: Hello,IAmAStringSnake! And a string snake looks something like this: Hel l rin o,IAmASt g S !ekan Your Task String snakes ...
24
votes
20answers
2k views

Find the first word starting with each letter

Given a string, find the first word starting with each letter (case insensitive). Sample Using Ferulas flourish in gorgeous gardens. as input: "Ferulas flourish in gorgeous gardens." ^^^^^^^ ...
34
votes
9answers
3k views

Snakify a String

A snakified string looks like this: T AnE eOf ifi ing h s x l A k e r isI amp Sna dSt Your Task Take a string s and a size n, then output the snakified string. The inputs ...
32
votes
18answers
3k views

Are the brackets fully matched?

You must write a program or function that takes a string of brackets and outputs whether or not that string is fully matched. Your program should print a truthy or falsy value, and IO can be in any ...
20
votes
9answers
1k views

Rectangle Detection

Write a program or function that takes in a multiline string of 0's and 1's. No other characters will be in the string and the string will always be rectangular (all lines will have same number of ...
26
votes
21answers
2k views

Palindromizing the strings

Introduction For the ones who don't know, a palindrome is when a string is equal to the string backwards (with exception to interpunction, spaces, etc.). An example of a palindrome is: abcdcba If ...
40
votes
31answers
3k views

Stretch the word

The input is a word of lowercase letters not separated by whitespace. A newline at the end is optional. The same word must be output in a modified version: For each character, double it the second ...
8
votes
7answers
566 views

Read a crossword

Inspired by this question about packing into this format. Occasionally I see a completed crossword and being as I am, I can't be bothered to find out what the solutions to the clues actually were. ...
14
votes
7answers
737 views

Turn a string into a windmill

The code on this site is rapidly being depleted. We need to invest in renewable strings. So you must write a program that takes a string and converts it into a windmill. The Challenge Let's take a ...
7
votes
3answers
120 views

Ordering words to fit in a given string

Given a string of letters and a set of words, output an ordering of the words so that they can be found in the string by dropping letters that are not needed. Words may occur more than once in the ...
13
votes
10answers
620 views

Determine the type of an input

The challenge is simple: Determine the type of an input, and output an identifier telling what type it is. "UI", Unsigned integer: 0, 1,34, 111111111111111111111111111111111111111111 "SI", Signed ...
32
votes
27answers
5k views

Passwordify the string

Your challenge is to passwordify the string! What is passwordifying, you ask? Take a string as input. This string will only contain uppercase letters, lowercase letters, digits, and spaces. You ...
36
votes
9answers
2k views

Unlocking the Secrets to a 1-Dimensional Labyrinth

Background You awake to find yourself lost in a one dimensional labyrinth! A mystical genie (or something) appears and explains that the exit lies in front of you, but that between you and the exit ...
18
votes
11answers
1k views

All possible ways to interleave two strings

I recently saw this question on stackoverflow. It's a great question, but there's one fatal problem with the question. They are asking for the best way to do it. E.g, easiest to read, most idiomatic, ...
17
votes
19answers
2k views

Javascript left-pad golf

Introduction In the wake of the left-pad npm package fallout, let's have a code golf for implementing left-pad. The left-pad function consists of 2 default arguments and 1 additional argument, in ...
15
votes
5answers
693 views

Make this code explanation pretty again

Introduction Most code-golfers here add explanations to their submissions, so it's easier to understand what's going on. Usually the codelines go on the left and the corresponding explanation to the ...
15
votes
68answers
2k views

Full Width Text

Full width text is text that has a space after every character, including the last one. For instance, the first sentence of this question becomes: F u l l w i d t h t e x t i s t e x t t h ...
17
votes
6answers
906 views

Length-encode a string

Suppose we use the following rules to pull a single string from another string, one containing only ASCII printable characters and called an *-string. If the string runs out before the process halts, ...
16
votes
11answers
1k views

Creating a falling ball map

Introduction For the ones who never heard of this game before. You are playing a ball which needs to survive as long as possible. This is done by moving to the left or right, going to the holes. ...
9
votes
4answers
249 views

Replace alias to form phrases

Inspired by the C-directive #define. Challenge Given one phrase with some alias, and one array with each alias text. Output the initial phrase replacing each alias with its respective text. An ...
7
votes
4answers
317 views

Naïve Markov Chain Word Generation

There are many ways to generate random words. You can take random syllables from a set, you can use n-tuples, probably neural networks (what can't they do?), alternating between consonants and vowels, ...
9
votes
1answer
252 views

Golf English – using contractions

I have not laughed as much from Stack Exchange content as I have from this. I think you all will enjoy this challenge, as it is inspired by what is over there. You will write a function or program ...
2
votes
1answer
158 views

Translate Java methods to fields

So, recently, I found myself reformatting my code for Vitsy to using anonymous class instances for commands rather than the normal method approach. For those who don't know, anonymous class instance ...
39
votes
6answers
769 views

There's an ant on my Rubik's Cube

A standard, solved, 3×3×3 Rubik's Cube has 6 differently colored faces, where each face is a 3×3 grid of squares of one color. The white face is opposite the yellow, the red opposite ...
22
votes
29answers
3k views

Making an acronym

Objective Your goal is to make a program that converts an input to its acronym. Your input is guaranteed to have only letters and spaces. The input will have exactly one space between words. You must ...
14
votes
3answers
341 views

Hungarian alphabetical order

For those who wish a lot more challenge then the old Spanish alphabetical order, let's take a look at how the Hungarian alphabet is ordered. a, á, b, c, cs, d, dz, dzs, e, é, f, g, gy, h, i, í, j, ...
11
votes
2answers
184 views

Word Search Helper

I've been doing word searches recently, and I thought it would be so much easier if all of the words read left-to-right. But rewriting all the lines takes a lot of effort! So I'm enlisting code ...
42
votes
16answers
3k views

Rotate the dots

Introductions A 2×n Boolean matrix can be represented as a string of the four characters . ':. The string has an "upper row" and a "lower row", with dots representing 1s and empty spaces ...
20
votes
6answers
1k views

Old Spanish alphabetical order

Before 1994, Spanish dictionaries used alphabetical order with a peculiarity: digraphs ll and ch were considered as if they were single letters. ch immediately followed c , and ll immediately followed ...
12
votes
3answers
405 views

How many sides does this polygon have?

So in 1st grade math, you learn the names of polygons. Three sides is a triangle, 4 is a square, and 5 is a pentagon. However, in 1st grade honors, you go a bit further. Your challenge There is a ...
-2
votes
16answers
344 views

Print all the numbers! (At least, as many as possible.) [closed]

Your task is to print a number. Simple, right? It is simple, but not as simple as this. The first answer is to print the number 1, the second answer is to print the number 2, etc. Rules The first ...
3
votes
5answers
388 views

Electoral votes from state name

Given a the name of a state of the United States as a string (with case), return the number of votes the state has in the Electoral College. Write a full program or function, and take input and output ...
-5
votes
4answers
157 views

Solve an algebraic expression

The Challenge Your task is to create a program that can solve an algebraic equation. Input Input will consist of a String. The string will be an equality involving the variable x, and follows the ...
12
votes
3answers
393 views

Half-reverse a binary string

This is a follow-up question to my Puzzling.SE question: I asked if there’s a function f mapping Boolean strings to Boolean strings, so that f(f(b)) = reverse(b) for all input strings b. (By reverse, ...
16
votes
1answer
279 views

The puppy command

The puppy utility takes a filename as input, and does exactly what you would expect a puppy to do: it shreds it! How to shred Rip out the pages with your teeth Split the input file on newlines. ...
36
votes
35answers
4k views

Making a coin fair

You have a coin that produces 0 or 1. But you suspect the coin may be biased, meaning that the probability of 0 (or 1) is not necessarily 1/2. A well known procedure to "transform" a biased coin into ...
17
votes
2answers
245 views

Follow the dots

The Challenge Given a rectangular grid of characters A B C D E F G H I J K L M N O P Q R S T and a grid with the same dimensions of dots and spaces . . . . . . . . . . . ...
7
votes
1answer
107 views

Find the Words on the Grid!

Write a program or function that extracts a word from a wordsearch using its start and end coordinates. The Input Your program or function should accept three parameters: the start coordinate, the ...
18
votes
13answers
978 views

Merging two strings

Introduction Let's say that S1 = a...b and S2 = ..c... If we place them on top of each other, we get: a...b ..c.. We merge both strings, with the . as the liquid character (which can overlapped). ...
21
votes
9answers
2k views

The XOROR sequence

Cellular Automata are truly fascinating. The ones that are usually talked about are the binary ones, i.e., the ones representable by a number. However, those, in my opinion, have been done to death. ...
13
votes
5answers
301 views

Generalization of abbreviations

Given an input of a list of words and their abbreviations, output the pattern by which the abbreviations can be formed. Let us take the example input of potato ptao puzzle pzze as an example (that ...
47
votes
15answers
3k views

Shifty Eyes Shifting I's

Shifty-eyes ASCII guys like to shift ASCII Ii's: >_> <_< >_< <_> Given a string of shifty-guys, spaced apart or separate lines, shift the Ii's side to side, left the wall ...
9
votes
1answer
210 views

Human Friendly Filename Detection

Introduction File names can be wildly varying things, ranging from a simple blah.txt to 303549020150514101638190-MSP0.txt. The former is usually human generated, while the latter is often machine ...
31
votes
12answers
3k views

Convert to camelCase

The Challenge I was reading Google's Java Style Guide the other day and stumbled over their algorithm to convert any arbitrary string into camelCase notation. In this challenge you have to implement ...
4
votes
3answers
84 views

Symbolic Differentiation of Composed Functions

Symbolic Differentiation 2: Back on the Chain Gang Task Write a program that takes in a certain sort of function from stdin and differentiates it with respect to x, using the chain rule.* The input ...