A competition to solve a particular problem through the usage and manipulation of strings.
8
votes
2answers
363 views
Apply English punctuation rules
You've been hired to write some code for a dictation-taking app, which takes voice input from a spoken source, parses it as words, and writes it down on a screen.
The management doesn't really trust ...
62
votes
11answers
15k views
I am passive aggressive and want to insult my boss without him finding out
It's been a rough few months at work and I feel like I just want to scream right to my boss' face. I am, however, not one to directly confront people I have a problem with. I also don't want to lose ...
8
votes
18answers
918 views
Check for occurences of string in other string
Challenge
I'm sure you read the title, and came in to farm your rep, thinking its kids' stuff, but think again! You have to challenge each other in the shortest code to count the occurences of a ...
30
votes
37answers
6k views
The shortest code to invert a binary string
Me thinks there aren't enough easy questions on here that beginners can attempt!
The challenge: Given a random input string of 1's and 0's such as:
10101110101010010100010001010110101001010
Write ...
7
votes
4answers
596 views
Generate keyboard shortcuts for a menu
Menu Shortcuts
Traditionally, user menus are accessible by keyboard shortcuts, such as Alt + (a letter), or even simply hitting the letter when all textboxes are unfocused (gmail style).
Your task
...
29
votes
2answers
2k views
Regex that only matches itself
There are some pretty cool challenges out there involving regex (Self-matching regex, Regex validating regex)
This may well be impossible, but is there a regex that will ONLY match itself?
NOTE, ...
17
votes
5answers
1k views
Leet to English Translation
Leet to English Translation
Your challenge is to write a program to translate (English) leetspeak/lolspeak/txtspk into normal English. Your program should read from standard input and output to ...
4
votes
28answers
1k views
Implement an integer parser
Implement an integer parser in the shortest code possible, with the following restrictions:
The function or program can only take one argument: a string (or equivalent). Assume it to be signed and ...
19
votes
17answers
2k views
How many IP addresses are in a given range?
Inspired by...
http://programmers.stackexchange.com/questions/241402/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, ...
18
votes
5answers
892 views
World IPv6 day 2014
To mark the anniversary of World IPv6 day, the Internet Society has published a campaign to Turn Off IPv4 on 6 June 2014 for One Day.
IPv6 addresses may be represented in their long form as eight ...
-2
votes
11answers
354 views
Code Golf: Create a string of 100 of the same character [closed]
The problem is to create a string of the same character repeated 100 times in as short a statement as possible. One potential solution is:
var i = 100,
s = '';
while(i--) s += "Z";
I'm looking ...
1
vote
19answers
693 views
Count how many characters are in the program's source
Write a program that counts and prints the number of characters in it's own source code to standard output.
The number must be generated from counting the characters.
This Ruby solution would not be ...
-4
votes
4answers
280 views
print text with no chars
Mission is write a program that prints "Hello World!". Simple?
Text must be human readable and should not be "|-| € |_ |_ 0 // 0 |? |_ |) \./" or something like that
Program should not contain:
...
17
votes
8answers
1k views
One Letter Swap
The largest forum on the web, called postcount++ decided to make a new forum game. In this game, the goal is to post the word, but the word has to have one letter added, removed, or changed. Your boss ...
-6
votes
1answer
99 views
Dealing with boolean strings [closed]
you have the following or similar string :
() || () || { () || () } && () || { () && () }
|| and && are used as operators.
() indicates of an boolean of that matter.(true or ...
14
votes
31answers
911 views
Shortest program to split a string at non-digits without RegExps
EDIT: If you're using Lisp, I have given some guidelines at the bottom in counting bytes.
Objective: Make the shortest function that splits a string at non-digits and returns an array consisting of ...
9
votes
23answers
1k views
Print a string with vertical words
Your task is to take an input string of ascii characters and output the string as a series of vertical words separated by spaces. An example is shown below:
Given the string:
Hello, World! My name ...
11
votes
8answers
1k views
Is it a prime? w/o math
Write a program or function in any language that tells if the input is a prime number.
The input is a string representing a natural number in base-10.
The output is one of the two strings "Prime" or ...
14
votes
1answer
740 views
Create a C preprocessor
The goal is to create a preprocessor for the C language, as small as possible in terms of source code size in bytes, in your preferred language.
Its input will be a C source file, and its output will ...
6
votes
17answers
757 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
...
9
votes
10answers
497 views
String of alphanumeric characters to a sorted list of comma-separated ranges
Given a string of unsorted alphanumeric characters, e.g.
ABC321STPpJqZZr0
output a ", "-separated list of character ranges, sorted by ASCII value, ignoring case and removing duplicates (i.e. ...
3
votes
7answers
300 views
Longest Common Subsequence of Two Strings containing a particular Substring
A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.
Given three strings A, B and C (note the order) ...
4
votes
10answers
472 views
Golf an LZW encoder
Given an alphabet and a string, your job is to create the
Lempel–Ziv–Welch compression of the string. Your implementation can either be a function with
two parameters and a return value, or a full ...
7
votes
6answers
268 views
Determine whether a car can get around a route with a limited amount of gas
Using any programming language that supports functions, have the function
is_enough(strArr)
that take strArr which will be an an array consisting of the following elements:
N which will be the ...
-5
votes
3answers
173 views
Shortest code to reverse a string [duplicate]
The winner will be the one to use the shortest code to reverse this string:
Today there was two clouds in the sky, each forming a shape.
It may be in any programming language.
2
votes
2answers
258 views
Hide one message inside another
Your task is to hide a small message or string inside a larger block of text. To do so, you must hide the message as capital letters inside the larger
For the quoted test:
Lorem ipsum dolor ...
1
vote
0answers
81 views
palindrome detection palindrome [duplicate]
Write a function with a single string parameter and a boolean return value. The function should return true iff the string is a palindrome character-wise.
Alternatively, write a program that reads a ...
46
votes
31answers
13k views
All Your Base Are Belong To Us (Restricted)
Input must not be required, and output must read "All your base are belong to us".
Restrictions
No external resources.
Plus a minimum of two of the following:
You cannot use "a", "b", "t", "u", or ...
21
votes
4answers
801 views
9-hole mini-golf: Text Manipulation
9-hole mini-golf: Description
9 (mostly fairly easy) code golfing challenges of varying difficulty
Penalties for using the same language more than once
All challenges about a specific theme (this ...
10
votes
3answers
217 views
Expand tabs (implement expand(1))
Your task this time is to implement a variant of the POSIX expand(1) utility which expands tabs to spaces.
Your program is to take a tabstop specification and then read input on standard in and ...
17
votes
19answers
3k views
Hello world!!! Fibonacci distribution
Your program should output exactly: Hello world!!! with or without linefeed after.
Your program should take no input.
Sourcecode character distribution must be correct according to:
The number of ...
4
votes
12answers
566 views
Shortest string expressions stable under deleting quotes
Forgetting quotes can lead to certain problems.
For example, in Scala the two expressions:
"("+("+")+(")+(")+")"
("+("+")+(")+(")+")
differ only in starting and ending quotes, but they ...
5
votes
1answer
243 views
Manipulate “RELATIVE” using 8 OP-codes
Rules:
Your program can be in any programming language.
Your program should not take any input.
Your program should transform the word "RELATIVE" into "STATIC". The word can at any stage only ...
13
votes
4answers
532 views
Syntax Highlighting for Greater Golf!
Golfers.
Together, we have banded together to produce code that is concise, is functionally beautiful and is uglier then the Phantom of the Opera from the original novel.
The time has come for us to ...
4
votes
4answers
164 views
printf-style string formatting
Challenge
Write a function that implements C printf-style string formatting.
Rules
You must implement at least %%, %c, %s, %d and %f.
You must not use a built-in string formatting method.
You must ...
5
votes
4answers
396 views
Cardinal Numbers in Standard American English
Let n be any integer between 1 and 999,999 inclusive. Your challenge is to write a complete program which using stdin or command-line arguments takes in n and outputs the number of times the letter ...
15
votes
17answers
1k views
Capitalize String
Given a string, capitalize it. By capitalization I mean conTeNT-lENgth changes to Content-Length. In the example I showed the string with 2 words with - as the word boundary. However I expect you to ...
-1
votes
1answer
282 views
Compressing a DNA-like string [closed]
my app is multiple choice test, where for each question the response results in a 4 letter string "eg" GTAC or ATGC or CATG, etc. There are always just 24 questions. so the final result is something ...
-1
votes
4answers
537 views
Find the longest word in a sentence without using regex [closed]
Have a function LongestWord(sen) take the sen parameter being passed and return the largest word in the string. If there are two or more words that are the same length, return the first word from the ...
-3
votes
2answers
248 views
Decode obfuscated Hello world [closed]
In the following string (number), there is an hidden message, the goal of this is to
find how this message is encoded
write the shortest code that permit to retrieve the original message.
The only ...
7
votes
5answers
635 views
Given a string find the substring which appears most often
Write a complete program (not just a function) which using stdin takes in a string of arbitrary length (assume string-length at least one) composed only of digits 0-9 and outputs using stdout the ...
5
votes
26answers
795 views
Run Length Decoding
Write the shortest code in the language of your choice to perform run length decoding of the given string.
The string will be supplied as input on stdin in the form
CNCNCNCNCNCNCNCN
where each C ...
0
votes
3answers
856 views
javascript: smallest code to convert seconds to time [closed]
Given seconds like 11728, write the smallest javascript function that returns a string like 3hrs. 15min. 28sec.
signature textTime([int] t,[bool] z,[bool] m)
t is the time like 11728 and you can ...
4
votes
11answers
561 views
Replace letters by their rank, keeping punctuation intact
The problem is simple. Given a string such as "Hello World" the program would output "8-5-12-12-15 23-15-18-12-4-!". Any delimiters will do, (please specify what they are though) I just chose to use ...
6
votes
3answers
442 views
Parse a Python string literal
The challenge is to parse a string like Python does and print the contents of the string.
Input (command-line argument or stdin): a string literal (e.g. "hello") (or multiple literals, see string ...
-3
votes
2answers
379 views
Strings: Microsoft interview
You are given an array of strings , you have to construct a single array containing all of them so that the same array of strings can be reconstructed from the large array. The strings may contain any ...
9
votes
1answer
448 views
Fix unbalanced brackets
Consider the alphabet A ="()[]{}<>". Think of the characters in the alphabet as opening and closing brackets of 4 different types. Let's say that a string over the alphabet A is balanced if
it ...
21
votes
6answers
1k 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
vote
7answers
754 views
Alien Name Generator [closed]
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
249 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 ...