Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [string]

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

7
votes
44answers
2k views

Letters challenge

Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a ...
24
votes
18answers
5k views

PronunciationSort™

We all know of different fancy sorting algorithms, but none of these give us numbers in a way that's easy to pronounce. To remedy this, I propose using PronunciationSort™, the most natural way to sort ...
12
votes
33answers
3k views

True color code

True color (24-bit) at Wikipedia is described in pertinent part as 24 bits almost always uses 8 bits of each of R, G, B. As of 2018 24-bit color depth is used by virtually every computer and ...
2
votes
1answer
175 views

I won't not use no double negatives [closed]

The goal is to simplify sentences containing multiple negatives. Like with multiplying negative numbers, two negative words annihilate each other until at most one is left (doesn't matter which one). ...
3
votes
6answers
691 views

No trailing but(t)s please!

This challenge was inspired by Yeah But No But Yeah. maxb´s colleague recently sent him the following piece of JavaScript as a joke: ...
22
votes
24answers
2k views

An ogl-edocf challenge

Input A non-empty shuffled string consisting of ASCII characters in the range \$[32..126]\$. Output The output is obtained by applying successive rotations to the input string. For each letter (<...
6
votes
5answers
523 views

The least weird fact about the US presidency right now

The least weird fact about the US presidency right now is that there have been two unrelated presidents whose last names start with T-R-U-M. That made me think, how many US presidents share other ...
3
votes
5answers
411 views

Transpile Brainstract to Brainfuck

Introduction Brainstract, a newly created dialect of Brainfuck adds a bit more elements to the syntax. In addition to the normal Brainfuck syntax, there are macros. To define a macro: ...
49
votes
65answers
17k views

Helloellolloloo Worldorldrldldd

Make a program that takes the word you input, and adds that word to the back of itself minus its first letter, then repeats until all letters are gone. For example, ...
28
votes
18answers
3k views

The Improved Caesar Pig Latin Cipher

The problem with the Caesar cipher is the resulting words are often unpronounceable. The problem with Pig Latin is that it is easy to decode. Why not combine them? Input A word consisting of the ...
11
votes
9answers
1k views

Everyone Ought to Have a Friend

An isolated character is a character (other than a newline) that doesn't have an adjacent character of the same type. Adjacent characters can be to the left, the right above or below, but not ...
44
votes
38answers
12k views

Yeah But No But Yeah

My colleague recently sent me the following piece of JavaScript as a joke: ...
4
votes
0answers
214 views

Simulate Casio S-VPAM calulator [closed]

It is 20th anniversary of Casio's S-VPAM calculators and it is worth celebrating. Task: Process input string as Casio S-VPAM calculator does. The infix notation and precedence of mathematical ...
15
votes
11answers
1k views

Simulate an NFA

A nondeterministic finite automaton is a finite state machine where a tuple \$(state,symbol)\$ is mapped to multiple states. Ie. we replace the usual \$\delta : Q \times \Sigma \to Q\ \$ transition ...
37
votes
41answers
7k views

I done did made a spaceship maw!

Introduction: Inspired by this comment of @MagicOctopusUrn on @Emigna's 05AB1E answer for my "It was just a bug" challenge: 8F9ÝÀNð×ý}».∊ I done did made a ...
4
votes
0answers
118 views

Find the hash in the text [duplicate]

I hate hashes because they remind me of hashtags, help me find them in the input Input A piece of text ...
15
votes
14answers
1k views

Repeat a rhyme and loop on the vowels

Vowels rhyme: Apples and Bananas There is a traditional children's song that repeats the same text over and over, only each time every vowel is replaced with a random vowel, but constant across the ...
3
votes
1answer
152 views

Sorting out redundant text from screen scraper application [closed]

You are writing a screen scraper application monitoring a text-only chat window. Text is added at the bottom of the window. The application takes screenshot of the chat window. If a change has ...
51
votes
30answers
6k views

Let's golf a BIBABOBU decoder

While I was traveling in the future, I noticed a funny game among kids circa 2275. When they don't want their great-great-great-great-grand parents to understand what they're saying, they use the ...
4
votes
0answers
317 views

Textbattles KoTH [closed]

Textbattles Textbattles is is strategy game about, well, text. It consists of a 10x10 grid, where each player has a position on the grid. When it is a player's turn, they can decide whether to move a ...
6
votes
6answers
854 views

Lucas and Fibonacci are in pair

Influenced by Non-discriminating Programming, I made up an idea of a similar challenge. Here, we say a string is a Lucas string if the number of appearances of each character is a Lucas number (2, 1, ...
1
vote
10answers
522 views

Indent your code according to Fibonacci

Okay, so I saw this in a meme and decided it'd be the perfect code golf challenge: I prefer to increase the side of my indents according to the Fibonacci sequence: ...
26
votes
23answers
2k views

Compare version numbers

When we publish some software, we assign a version number to it. And users may want to update to the latest version of some software. So, it is the time to find out which version should be newer. ...
35
votes
9answers
2k views

Indentation-based Sort

Given an ordered list of same-case letter strings (a-z XOR A-Z) where each string is preceded by 0 or more space ( ) characters, output the same list but with the strings sorted at each level of ...
18
votes
34answers
3k views

Tower of strings

Given a string of text, output it as a 'tower'. Each slice of the string (of the form 0:n) is repeated 5*n times, so the first ...
12
votes
17answers
2k views

Codegolf Rainbow : Draw in Black-and-White

Introduction: (Source: Wikipedia) When we look at a rainbow it will always have the colors from top to bottom: Red; orange; yellow; green; blue; indigo; violet If we look at these individual rings, ...
18
votes
9answers
681 views

Maximum Hamming distance among a list of padded strings

The Hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. If the strings are not of equal length, the Hamming distance is ...
30
votes
8answers
1k views

Make an alphabeTrie

Consider the following alphabetically sorted list of words: balderdash ballet balloonfish balloonist ballot brooding broom All of the words start with ...
9
votes
26answers
1k views

A function to take three integers and return a list of integers and alphabet-letters

Challenge We take three positive integers a, b, and c as input. Using these integers, first ...
14
votes
8answers
2k views

crossed out 44 is still regular 44 ;(

Introduction On March 24th, 2015 @isaacg golfed his Pyth answer from 44 to 42 bytes. Since a crossed out 44 (44) looks a lot like a regular 44, @Optimizer made the following comment: striked out ...
0
votes
1answer
113 views

Symmetric Numbers [duplicate]

write a function to tell if a number is symmetric or not. for example: input: 151 output: True input: 142 output: False and so on: 1111 True, 2390 False, 1226221 True
7
votes
3answers
177 views

Evaluate Words Based on “Rules” (Skeptics.SE Crossover)

I came across this picture, which I initially questioned and thought about posting to Skeptics. Then I thought they'll only tell me if this one case is true, but wouldn't it be great to know how true ...
15
votes
22answers
3k views

Test if a string is parenthesly balanced

We call a parens group the open paren (, its matching close paren ) and everything inside them. A parens group or string is ...
6
votes
2answers
183 views

What associativity was it again

Non-associative operators (for example the subtraction-operator) often are either left- or right associative, such that one has to write less parentheses. Consider for example the following: $$ a-b-c ...
19
votes
34answers
2k views

Increment base-36 strings

This is a code golf version of a similar question I asked on stack earlier but thought it'd be an interesting puzzle. Given a string of length 10 which represents a base 36 number, increment it by ...
16
votes
17answers
2k views

Alternating Pattern

In a now deleted stackoverflow question, someone posted the following: Write a program or function to print alternating patterns in * and ...
16
votes
30answers
1k views

Search text for a prefix and list all its suffixes in the text

I use "suffix" loosely here to mean "any sub-string that follows the prefix". "Prefix" here means the START of a word, where a word's start is defined as either after a space or from the first ...
12
votes
10answers
3k views

Golfing Emoticons

Introduction Your challenge today (inspired by this challenge) is to write a number of snippets, functions or full programs each that output various ascii emoticons, without reusing characters. ...
24
votes
30answers
2k views

Count Consecutive Characters

Given a string containing only letters, output the length of the longest run of consecutive alphabetical letters the word contains, where order does not matter. An example algorithm may sort the word, ...
49
votes
29answers
8k views

Which Go rank is higher?

Players of the traditional board game Go measure their skill in a system of ranks: Players new to the game are ranked 30th kyū (written 30k) and progress counting ...
7
votes
10answers
531 views

How many bytes is it

This time, we want render the count of bytes in a human readable way to user. Let's write a program (a full one or a function or other acceptable formats) to do this. Input An non-negative integer, ...
14
votes
19answers
988 views

Addition-Subtraction of Numbers Within String

Take a string as an input, and perform addition/subtraction of all the digits in the string and output the sum of those operations as the result. Rules The digits in the string are read from left ...
12
votes
23answers
2k views

Convert Numbers to Letters, and vice-versa in a string

Based on a list of numbers and their equivalent letters, take a string input, replace the characters of that string with the equivalent number/letter and output the result. List 1 = a 2 = b ...
31
votes
12answers
2k views

Pleasanortmanteaus

A portmanteau word is a combination of two words that takes part of each word and makes them into a single new word. For example, lion + tiger => liger. Let's write a program to generate portmanteaus ...
19
votes
3answers
595 views

Spoonerise words… in Finnish

This challenge is based on, and contains test cases from, a programming course I took at Aalto University. The material is used with permission. Two and a half years ago there was a challenge about ...
25
votes
25answers
2k views

Detect Perfect Pairings

Let's have a function \$f\$ that takes a string and removes all pairs of adjacent identical characters. For example \$f(a\color{red}{bb}ba\color{red}{cc}) = aba\$ Note that when two pairs overlap ...
25
votes
30answers
2k views

Let's design a digit mosaic

Challenge Given a positive integer \$N\$, repeat each of its digits \$d_1, d_2, d_3, \cdots, d_n\$ a number of times corresponding to its position in \$N\$. In other words, each digit \$d_k\$ should ...
22
votes
10answers
3k views

Bake me some moji

Given a string, character list, byte stream, sequence… which is both valid UTF-8 and valid Windows-1252 (most languages will probably want to take a normal UTF-8 string), convert it from (that is, ...
15
votes
4answers
308 views

Zigzag this string by collapsing duplicates

Given a string, your task is to collapse it into a zigzag-like structure as described below. Folding into a Zigzag We'll take the string "Mississippi" as an ...
13
votes
12answers
1k views

Fun with strings and numbers

Here's a programming puzzle for you: Given a list of pairs of strings and corresponding numbers, for example, [[A,37],[B,27],[C,21],[D,11],[E,10],[F,9],[G,3],[H,2]]...