Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A competition to solve a particular problem through the usage and manipulation of strings.
43
votes
ETAOIN SHRDLU golf
To meet spec, I turned my answer into a function that takes a string argument. To my surprise, it was two bytes smaller! … '
sorted(map(chr,range(65,91)),key=s.upper().count) # Sort by that function
''.join(sorted(map(chr,range(65,91)),key=s.upper().count)) # Concatenate to string …
21
votes
Spoonerise words
brainfuck, 238 207 bytes
,[[<+<+>>-]++++[<-------->-]-[<<-->>-----]<<+++++[----[----[------[------>>]]]]>[>>]>,]<<++++++++[<[++++<<]<++++<[++++<<]>>[>>]>>[>>]<-]<[<<]-[<+>---]>[>.>]<[<<]<<[<<]>[>>]>[ …
14
votes
Remove all occurrences of the first letter of a string from the entire string
. @) from the string. This is okay, because only letters and spaces will ever be present. …
14
votes
Reverse indentation
Make a list of all the lines in the input, define a function that tells you how much leading whitespace a string has, and make a sorted list of values that function spits out for each line of input. … l # string with the line
f(l) # amount of leading whitespace
d.index(f(l)) # where it is in list of whitespace …
14
votes
Surround a string with hashes
pb - 89 bytes
v[4]w[Y!-1]{b[35]^}w[B!0]{t[B]vvv>>b[T]^^^<}v>>>w[Y!4]{b[35]v}w[X!0]{b[35]^[Y]b[35]v[4]<}
This is the kind of challenge pb was made for! Not that it's competitive for this kind of cha …
11
votes
Convert C header names to C++ header names
brainfuck - 25 23 bytes
,[>,]<-----.<,<[<]>[.>]
If your language of choice does not support functions, whole programs are also acceptable.
This is a whole program that takes input from STDIN.
…
9
votes
Convert C header names to C++ header names
I wrote a custom puzzle for this challenge, which allows me to take input and check output against a known-correct "string". … This is the string I used for my byte count:
MOV 99 ANY
MOV -46 ACC
ADD UP
JEZ D
ADD ACC ANY
JRO -5
D:ADD UP
MOV UP ANY
MOV UP ANY
That's the text of each non-empty node, seperated by newlines (effectively …
9
votes
Help me Open the Box
pb (NONCOMPETING), 125 bytes
^w[B!0]{>}w[B!45]{<w[B=10]{t[T+1]b[0]}}v[X]vw[T!0]{vb[124]<[X]b[124]>w[B=0]{>}t[T-1]}w[X!1]{<b[95]}<w[B!0]{^}w[Y!-1]{b[47]>^}
The version of pbi that you need to run this …
8
votes
Surround a string with hashes
brainfuck - 156 bytes
++++++++++>,[>>+++++[<+++++++>-],]<....[.---<<]>>+++>>+++.---.[.>>]<<.+++.[<]>.>>+++.---.<[.>>]<<<.>>.---[<]>.--->>+++.---[.>>]<<..+++.---[<]>[+++.>>]<<....
This is probably g …
6
votes
Decode Baby-talk!
brainfuck, 656 bytes
+[[>>>,[>++++[<-------->-]]<]<<[>]<-[+[<+>>+<-]----[>>+<<----]>>+[<[-<]<[>]>>-]-<[[-]>+<]>[[-[->]<<+>]<->>>]<<<[>>>+<<<-]<<-]>>>>>[[<+>>+<-]----[>-<----]>--[----<]<[>]>[----<]<[>] …
5
votes
Shortest code to print ':)' random times
Python 2.7 - 45 bytes
print':)'*__import__('random').randint(0,255)
(Originally this printed :)\n, the newline was removed upon OP's clarification)
The (slightly) more idiomatic way to do this is
…
5
votes
Significant Whitespace
Python, 228 198 182 166 146 145 bytes
Counter (72 bytes):
ior1=0
w=lambda i:i.split()if ior1 else sum(ord(c)in(9,10,32)for c in i)
Splitter (73 bytes):
ior1=0
w=lambda i:i.split()if i or 1else s …
3
votes
"Hello, World!"
pb, 80 bytes
b[72]>b[101]>b[108]>b[108]>b[111]>b[44]>>b[87]>b[111]>b[114]>b[108]>b[100]>b[33]
Super naive. I tried to golf it down by keeping 108 (the character code for "l") in T, either by doing …
3
votes
Make Bracket Squares
pb - 449 bytes
^w[B!0]{w[B=40]{b[39]}t[B]w[B!0]{w[B=T]{^b[1]}w[B=T+1]{^b[1]}w[B=T+2]{^b[2]}^[Y]^>}<[X]^w[B!1]{>}t[1]b[0]w[T!0]{>w[B=1]{t[T+1]b[0]}w[B=2]{t[T-1]b[0]}}b[3]vw[B!0]{>}^w[B!3]{b[0]<}b[0]vb …
2
votes
Monday Mini-Golf #3: Anagram distance
pb, 648 bytes
^w[B!0]{t[B]vb[T]^>}vb[-1]w[X!0]{<t[64]w[T!0]{w[B!0]{b[B-1]v}^[Y]t[T-1]}}w[B!-1]{w[B=0]{b[27]}t[26]w[T!0]{w[B!0]{b[B-1]v}^[Y]t[T-1]}>}b[0]w[X!0]{<w[B!0]{b[1]v}^[Y]w[B=0]{b[32]}w[B=1]{b[0 …