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

learn more… | top users | synonyms

2
votes
3answers
222 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
509 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
321 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 ...
12
votes
19answers
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 ...
14
votes
8answers
994 views

Discrete Baker's Map

Introduction The Baker's map is an important dynamical system that exhibits chaotic behavior. It is a function from the unit square to itself defined intuitively as follows. Cut the square ...
-1
votes
0answers
95 views

Implement fastest DFA in x86 Assembly for matching regex in ASCII character set [closed]

Write a DFA in assembly that can match the first occurrence of the regex a*Bc* in an arbitrary ascii string in the fewest possible cycles, given that: The string to match against is ...
23
votes
9answers
2k views

Two-way Palindromic Closure Generator

Introduction A palindromic closure of an input string is the shortest palindrome that can be constructed out of the input string where the final palindrome starts with the input string. For this ...
3
votes
4answers
263 views

Words of centuries

I'd like to get a list of words that are strongly connected with a particular time epoch, for example, 19th century, 20th century and 21st century. I suspect that nobody used a word like "smartphone" ...
1
vote
12answers
383 views

Palindromic palindrome generator

Create a program, that converts input string to a palindrome starting with the input string. The program itself must be a palindrome. For example input: neverod, print neveroddoreven. You should ...
16
votes
5answers
559 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 ...
6
votes
3answers
246 views

Latin Word Judgment

Because I can't concentrate on any task for more than about 5 seconds, I often find myself breaking up words into a sub-strings, each of which is a different length and doesn't contain any repeated ...
21
votes
22answers
2k views

The Characters in the String Go Round and Round

(Inspired by an early draft of PhiNotPi's fractal line challenge.) You're given a width W > 1, a height H > 1 and string consisting of 2(W+H-2) printable ASCII characters. The task is to print ...
35
votes
5answers
2k views

Adding Numbers with Regex

I want to try a new type of regex golf challenge, which asks you to solve nontrivial computational tasks with nothing but regex substitution. To make this more possible and less of a chore, you will ...
14
votes
9answers
1k views

Keep the unique characters down

It's very simple: Your program or function should generate the following text: Elizabeth obnoxiously quoted (just too rowdy for my peace): "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG," giving me a ...
36
votes
6answers
1k 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 ...
7
votes
1answer
602 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. ...
8
votes
4answers
357 views

Prelude Syntax-Checker

Prelude is an esoteric programming language, which has very few, but unusual, restrictions on what constitutes a valid program. Any block of printable ASCII text ("block" meaning that lines of ...
24
votes
34answers
3k views

Check whether letters of word are in alphabetical order

Write a function/program that accepts a string of lower/uppercase letters [A-Za-z] as input, that checks whether the occuring letters are unique and in alphabetical order (ignoring lower and ...
20
votes
2answers
333 views

Golf Down the PPCG Usernames

A comment I made in chat and the ensuing conversation inspired me to make this challenge. Am I the only one referred to by initials around here? We are all about golfing things down. We can have ...
19
votes
6answers
1k views

A Mnemonic for Remembering 23940

The major system is a mnemonic device for converting numbers into words so they can be memorized more easily. It is based on how words sound phonetically, but to keep things simple for the challenge ...
-2
votes
4answers
132 views

Extract URI parts without using libraries [closed]

Given a URI like: postgres://username:password@hostname:PORT/dbname Extract it all into an array data-structure, like so: ['postgres', 'username', 'password', 'hostname', 'PORT', 'dbname'] More ...
3
votes
2answers
285 views

Generate unique non-sequential string of length n without memory of previously generated strings

Scenario: Imagine a situation where you wish to share a unique alphanumeric code. Perhaps it is a one-time-use coupon code you hand write on business cards, or some other scenario where it is ...
17
votes
34answers
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 ...
16
votes
8answers
1k views

Convert human readable time interval to date components

Challenge Write the shortest program that converts a human readable time interval to date components of the form: {±YEARS|±MONTHS|±DAYS|±HOURS|±MINUTES|±SECONDS} Sample cases Each test case is ...
8
votes
9answers
611 views

Find Privileged Substrings

Privileged Strings The set of privileged strings is defined recursively as follows. All strings of length 0 or 1 are privileged. A string s of length at least 2 is privileged, if there exists a ...
6
votes
2answers
183 views

String Equivalence: Counting Substrings

Background Two strings s and t are called k-Abelian equivalent (shortened to k-equivalent in the following) for a positive integer k if the following conditions hold: The length-k-1 prefixes of s ...
0
votes
0answers
71 views

Find the longest recurring substring [duplicate]

Given a string of no more than 255 characters, find a function that returns the longest recurring substring. An example would be: aabbacadeauaaabba where the longest recurring sub-string is ...
-4
votes
5answers
192 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 ...
14
votes
15answers
2k views

Fill In the Blanks

Input A nonnegative integer n, and a nonempty string s containing only alphanumeric characters and underscores _. The first character of s is not _. The underscores of s are interpreted as blank ...
16
votes
7answers
1k views

Typing with scrambled keys

Your friend isn't too good with computers so as a practical joke someone scrambled the letters (a-z) on his keyboard. When he sit down and tried to type his name looking at the keyboard he realized ...
10
votes
11answers
601 views

Binary encryption

This is based on xkcd #153. Make a program or named function which takes 2 parameters, each of which is a string or a list or array of bytes or characters. The second parameter will only contain ...
23
votes
16answers
2k views

Shortest Unique Substrings

Input An alphanumeric string s. Output The shortest string that occurs exactly once as a (contiguous) substring in s. Overlapping occurrences are counted as distinct. If there are several ...
4
votes
3answers
363 views

Code Golf: Gibberish Echo

This is my first code golf challenge, as such I am not entirely certain if it is suitable as a Code Golf challenge, but it's all a learning experience. The challenge is that in as few characters as ...
-2
votes
2answers
164 views

Find Anagrams in the Dictionary [closed]

This a code challenge. The winner will be the person to provide the most efficient implementation of the solution in terms of algorithmic complexity. Using the dictionary found in '/usr/share/dict' ...
11
votes
22answers
1k views

String to Binary

This is a code golf challenge. Just like the title says, write a program to covert a string of ascii characters into binary. For example: "Hello World!" should turn into 1001000 1100101 1101100 ...
14
votes
17answers
2k views

Find the substring with the most 1's in a sequence

Introduction I want to find the substring with the most 1's in a sequence of 0's and 1's. Input Your program has two inputs, the sequence and the substring length. The sequence is any number of ...
6
votes
3answers
392 views

Retrograde morse (d)e(n)coder

This question is inspired by retrograde music. Retrograde music is a piece of music that can both be played normally (from the beginning to the end) as reversed (from the end the beginning). A similar ...
2
votes
1answer
114 views

String generator based on a wildcard [duplicate]

Your task, if you accept it, is to make a string generator that generates strings based on a wildcard. You can make a function or a full program that receives 1 argument and sends to the standard ...
12
votes
4answers
578 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 ...
35
votes
9answers
2k 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 ...
18
votes
9answers
1k 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 ...
45
votes
20answers
5k 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, ...
16
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 ...
10
votes
2answers
387 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 ...
9
votes
15answers
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 = ...
11
votes
5answers
400 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 ...
7
votes
2answers
322 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 ...
38
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 ...
20
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 ...
4
votes
4answers
501 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 ...