A competition to solve a particular problem through the usage and manipulation of strings.
-3
votes
0answers
39 views
I need help on how to correct the error : java.lang.NoSuchMethodError: main Exception in thread “main” [on hold]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class LinkNode {
private int data;
private LinkNode next; //* reference next in LinkNode
...
8
votes
7answers
785 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 ...
7
votes
0answers
218 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 ...
-1
votes
4answers
218 views
Four-Letter Words
Your task is to write a program that, given a text input, filter 'four-letter words' from the text, using any desired technique.
Only vulgar words with exactly four letters in them need to be ...
6
votes
14answers
625 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
...
7
votes
10answers
355 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
209 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) ...
5
votes
10answers
382 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 ...
6
votes
6answers
239 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
84 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
223 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
73 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 ...
45
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 ...
19
votes
4answers
665 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 ...
8
votes
3answers
197 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 ...
16
votes
19answers
2k 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
466 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
220 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
487 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
147 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 ...
4
votes
4answers
350 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 ...
13
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
226 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 ...
0
votes
4answers
279 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
200 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
463 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 ...
4
votes
26answers
708 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
486 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
536 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
336 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
337 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
417 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 ...
-3
votes
2answers
541 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 ...
21
votes
6answers
982 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', ...
0
votes
7answers
676 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
242 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 ...
10
votes
9answers
690 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
587 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
496 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
255 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 ...
4
votes
8answers
458 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
417 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
541 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
365 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
209 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 ...
15
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
388 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
559 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, ...
8
votes
12answers
568 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
2k 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 ...