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

learn more… | top users | synonyms

4
votes
0answers
260 views

Fastest simple regex matcher

Write a regex matcher that supports the following special characters. ? -> matches 1 or none of the previous character, class, or group * -> 0 or more of the previous character, class, or ...
-4
votes
3answers
206 views

Search for all the possible permutations of one String in another string

Suppose you are given two strings like String 1 = "ipsum" String 2 = "Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem sipum has been the industry's standard ...
19
votes
6answers
703 views

Shortest common superstring

Given a list of strings s_0, s_1, ..., s_n find the shortest string S that contains each of s_0, s_1, ..., s_n as a substring. Examples: S('LOREM', 'DOLOR', 'SED', 'DO', 'MAGNA', 'AD', ...
-1
votes
7answers
488 views

Alien Name Generator

Task Write a function to generate names of aliens and their worlds, so that the output is of the form: Greetings Earthfolk, I am ____ of the planet _____. "Rules" Best space-sounding-ness to code ...
3
votes
4answers
210 views

Count characters in lo..ol and print a phrase [duplicate]

Assuming 'lol' with a variavle number of 'o's. Print a the following phrase: What does 1st, 2nd, 3rd, 4th ... 'o' stand for? Examples: lol -> What does 1st 'o' stand for? loooool -> What ...
8
votes
6answers
486 views

Create a Twitter Parser

Introduction You use Twitter (let's pretend, if not), where you are limited to 140 characters per individual tweet you care to share with the world. If you wanted to tweet to your followers Abraham ...
5
votes
12answers
539 views

Output code-sized text

Output the same length of Lorem ipsum your code is! Rules: length is bits/8 length has to be positive code can't be identical to output no compression library shortest or super creative program in ...
8
votes
2answers
376 views

Email validation

Write a function or program to validate an e-mail address against RFC 5321 (some grammar rules found in 5322) with the relaxation that you can ignore comments and folding whitespace (CFWS) and ...
8
votes
5answers
231 views

Arbitrary-Length Ternary Squarefree Words

A string is squarefree if it contains no substring twice in a row. It is possible to have an arbitrarily long squarefree word using a 3-letter alphabet. Write a program which accepts a positive ...
3
votes
8answers
393 views

Cambridge Transposition

I'm sure most, if not all, of you have come across this at some point or another: Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, ...
3
votes
8answers
388 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: ...
4
votes
9answers
504 views

Ode-cay Olf-gay

Write a program which accepts a sentence into stdin, and writes that sentence to stdout in pig latin. Here are some test cases which your program should handle: Input: Read your script Output: ...
-5
votes
2answers
294 views

Implementing a Traffic Light Checker

A three-color traffic light must switch lights in the following order: red, green, yellow, red. To indicate when crossing slowly without a stop is permitted, the yellow signal may be flashed. To ...
0
votes
2answers
172 views

Storing a DNS name as compactly as possible in memory (preferably in C#) [closed]

What is the most compact way to encode/save DNS names in memory? For example, storing "www.google.com" as a string in .NET will result in the object being encoded as UTF-16, and it will consume twice ...
13
votes
26answers
2k views

Print custom alphabet

The Challenge Display the alphabet from a given letter read from console input. If the letter is uppercase, you have to display the alphabet uppercased. The alphabet printed must end in the precedent ...
3
votes
7answers
373 views

Finding variables in code

Given some code in your language as a string, find and display all the variable names. Examples in pseudocode: a=2 b=3 for(i, 0->9) do b=b-10 if a=b then write "a equals b" Returns: a b i ...
1
vote
4answers
515 views

Detecting loops in in in strings

Given a string, mark which parts in the string repeat in box brackets, and write how many times it does so before the box. Example:st st st Hello ThereThere st(with a space after) repeats 3 times, ...
0
votes
0answers
87 views

String helper array [closed]

My problem is that I am using the random string creator shown below, I am not using 'alpha', I am using 'fourlet'. The only problem is that this in an array and that substr($pool, mt_rand(0, ...
5
votes
7answers
316 views

Topographic Strings

Here is some example input, so I can explain what the problem is: ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) Think of this line of text as a topographic map of some mountains. Each set of ...
10
votes
19answers
1k views

Remove vowels without using too many different characters

The challenge is to remove vowels (a, e, i, o, u) from string from STDIN (yes, I know, simple). You can expect that your program will be not ran with any arguments in argv. Example: This program ...
29
votes
51answers
4k 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 ...
5
votes
25answers
2k views

Is string X a subsequence of string Y?

Given strings X and Y, determine whether X is a subsequence of Y. The empty string is regarded as a subsequence of every string. (E.g., '' and 'anna' are subsequences of 'banana'.) Input X, a ...
4
votes
7answers
1k views

Find the minimum edit distance between two strings

Explanation The edit distance between two strings is a function of the minimum possible number of insertions, deletions, or substitutions to convert one word into another word. Insertions and ...
0
votes
3answers
106 views

all occurences of each line from a file in another file for each line in the first file

This is a code golf problem: Say you have two files, one file s and one file h. The problem is that for each line l of s you should produce a list that contains all lines of h that contain l. By ...
3
votes
4answers
446 views

Implement Oplop

Oplop is an algorithm to generate website specific passwords based on a master password and a keyword. It is described here: http://code.google.com/p/oplop/wiki/HowItWorks There's an online ...
7
votes
7answers
592 views

ASCII ruler generation

The challenge is to generate an ASCII character count ruler in the following format: +-------------------------------------------------------------------------+ || | | | | | | | ...
-2
votes
2answers
491 views

Conversion to palindrome with minimal points used

Input: a word (2-100 characters) Convert this word to a palindrome: delete character - 13 points add character - 12 points increase character - 5 points ('d' > 'e') decrease character - 4 points ...
4
votes
1answer
305 views

String manipulation

The challenge is to manipulate strings using basic Vim-like commands Input: A string of text to be transformed. The input alphabet is [a-z]. A string of legal commands Output: The transformed ...
6
votes
13answers
956 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 ...
2
votes
11answers
367 views

Write the shortest code to match a tail-repeating string where one character falls off the head in each repetition

In this code-golf, you will attempt to match a string that is tail-repeating with one character falling off the head on each iteration. The code needs to be able to accept a string, and return to the ...
1
vote
32answers
1k views

Print an n-by-n Box

Simple problem: print an n by n box from a function. A couple caveats:  -You may not use any loops  -The function must have exactly one parameter of type int (or the equivalent in your ...
-4
votes
4answers
286 views

Code Golf: simple way to get min & max

This is my first attempt at starting a code golf contest. whats needed is a simple way to get min & max (without using built in max & mix functions, of course, because Perl does not have it :D ...
7
votes
7answers
402 views

Check if a string is a shuffle of twins

Explanation Two strings can be shuffled by interspersing their letters to form a new string, much like two piles of cards can be shuffled to form a single pile. For example, the strings HELLO and ...
1
vote
2answers
322 views

Decompose a String

Challenge You are to write the shortest complete program that takes a string as input from STDIN and decomposes it as far as possible, and prints the composition to STDOUT. To decompose a string, ...
10
votes
8answers
737 views

Write a function that returns past tense of given verb

Challenge Write a function which takes an argument which is a verb, and returns the past tense of the verb. (Assume that the verb is regular) Past tense Note: consider y as neither consonant ...
-1
votes
2answers
947 views

Find and replace characters in a string to translate code using Python [closed]

I have an unintelligible string of characters with a simple key: every letter's true value is the letter +2 in the alphabet. Example: A --> C ; M --> O. I wrote a simple python function that accepts ...
5
votes
8answers
486 views

Program to Spoonerise words

A spoonerisation is swapping the first letter/pronounceable syllable of two or more words. Example: A lack of pies = A pack of lies. Bad salad = Sad ballad (ish) :) Challenge: Write a program to ...
4
votes
1answer
238 views

How to encode shortest brainf_ck strings

This is an interesting one. I have written a short program in objective-c to encode a string into a brainf_ck string, this is what it looks like: NSString *input; // set this to your input string ...
30
votes
50answers
3k 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 ...
8
votes
6answers
355 views

Soundex function

Write the shortest function to generate the American Soundex code for a surname only containing the uppercase letters A-Z. Your function must produce output consistent with all the linked page's ...
10
votes
18answers
1k views

Indent a string using given parentheses

Given the following input to the program: List of block start characters List of block end characters A string to format format the string with the blocks delimited by the two character sets ...
10
votes
31answers
1k views

Detect rotated strings

Read two strings from stdin. Output Yes if one string is a rotated version of the other. Otherwise output No Testcases Input CodeGolf GolfCode Output Yes Input stackexchange changestackex ...
4
votes
7answers
220 views

Finish a symmetrical map

You are given one-quarter of a map that is symmetrical over the x- and y-axes as input. The program should print the complete map. The map can contain the following characters: -+/\|., and they ...
6
votes
9answers
289 views

Sum of integers in string, separated by non-numericals such as 'a' and 'Y'

Create a program which sums all integers found in a string which is set as a variable in the program (thus, the program doesn't have to handle any input). The integer numbers are separated by ...
8
votes
20answers
932 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 ...