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

learn more… | top users | synonyms

2
votes
1answer
161 views

DoIt Java Style

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 ...
8
votes
1answer
203 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
451 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 ...
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 ...
40
votes
56answers
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 ...
12
votes
20answers
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 ...
10
votes
6answers
336 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 ...
5
votes
11answers
536 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 ...
12
votes
19answers
3k views

Outputting ordinal numbers (1st, 2nd, 3rd)

I would like to generate (as a return result of a function, or simply as the output of a program) the ordinal suffix of a positive integer concatenated to the number. Samples: 1st 2nd 3rd 4th ...
21
votes
19answers
3k 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 ...
14
votes
8answers
1k 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
vote
11answers
394 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 ...
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 ...
6
votes
3answers
250 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 ...
3
votes
4answers
264 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" ...
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 ...
37
votes
24answers
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 ...
16
votes
5answers
563 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 ...
7
votes
1answer
607 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. ...
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 ...
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 ...
8
votes
4answers
359 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 ...
19
votes
39answers
5k views

Answer to life, the universe, and everything

Post the shortest code possible that will output 42 only if the input is: abbcccddddeeeee ... zzzzzzzzzzzzzzzzzzzzzzzzzz
20
votes
2answers
334 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 ...
6
votes
19answers
948 views

Write a program for splitting the string with alternative spaces

Want to write a program in minimum number of code,all programming language accepted Runtime criteria also challanged Example: Input : abcdef Output: a b c d e f ab cd ef abc def ...
12
votes
35answers
3k views

Display number of occurrences for every character in an input string

The code should take a string as input from keyboard: The definition of insanity is quoting the same phrase again and again and not expect despair. The output should be like this(not sorted in any ...
3
votes
9answers
562 views

Find The Least Common Characters

Given a string, find the 10 least common alpha-numeric characters within that string. Output should be formatted with numbers left-padded with spaces so they look like this: e: 1 t: 16 c: ...
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 ...
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 ...
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 ...
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 ...
-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
289 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 ...
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 ...
-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 ...
0
votes
0answers
72 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 ...
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 ...
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
602 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 ...
4
votes
3answers
364 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' ...
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 ...
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 ...
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 ...
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 ...
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, ...