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.
4
votes
A Mnemonic for Remembering 23940
Python 2, 215 208 bytes
This Python solution builds a regex from parts indexed by the command line argument, then tests each word with that (rather large) regex.
import re,sys
a='[sz] (d|th?) n m r …
6
votes
Reimplement the wc coreutil
Python 2, 100 77 bytes
This solution is a Python function that accepts a multi-line string and prints the required counts to stdout. … Note that I use a format string to build a format string (which requires a %% to escape the first format placeholder).
Edit: Saved 23 bytes due to print optimisations by Dennis. …
9
votes
5
answers
255
views
Ordering words to fit in a given string
Given a string of letters and a set of words, output an ordering of the words so
that they can be found in the string by dropping letters that are not needed. … Your program or function can accept the letter string and words as lists, a string, or from STDIN, and must output all words in a correct order as a list
or string output. …
4
votes
Capitalize first letter of each word of input
Python 2, 73 bytes
i=raw_input()
print''.join((c,c.upper())[p==' ']for p,c in zip(' '+i,i))
This program capitalises a letter if preceded by a space (with a kludge for the first character in the string … It relies on the .upper() string method to capitalise correctly. …
2
votes
Find Anagrams in the Dictionary
Python 2
Efficient to write, and reasonably efficient to run.
groups = {}
for word in open('/usr/share/dict/words'):
word = word.strip()
signature = ''.join(sorted(list(word)))
if signat …
2
votes
Detecting anagrams within a Parent String
Python 2, 76 70 bytes
This lambda function iteratively compares each sorted substring with the target substring. The matches are counted and returned.
lambda a,d:sum(sorted(d[n:n+len(a)])==sorted( …
3
votes
Keep the unique characters down
Now what if I get rid of the function names and rely on string formatting? … Ok, What if I took the obvious way and just printed the string:
# 131*60 = 7860
print'Elizabeth obnoxiously quoted (just too rowdy for my peace): "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG," giving …
14
votes
Language Design: 2-D Pattern Matching
matching), reob9b.search(matching)
print 'Not found:', reob9a.search(nomatch), reob9b.search(nomatch)
This set of 2 searches finds 2 vertical and 2 horizontal matches, but cannot
find the embedded #.,# string …
3
votes
A Basic Pyth-like Syntax Checker
Python 2, 353 bytes
The parse function steps through the tokens one at a time and builds a tree of the program structure. Invalid programs trigger an exception which causes a zero (Falsy) to be print …
6
votes
Optimize the Scralphabet
Python 2, score: 1840 2162
This program first finds the best scoring word available with the given tiles (without using wildcards), then makes 10000 attempts to include random words that meet the con …
2
votes
LaTeX Table Generator
Python 2, 197 bytes
This solution uses string formatting to reduce repetition. Each string component is assembled, then placed within the template. … I used the raw string r'\\' and multi-line '''blah \n blah''' string techniques here. …