Questions tagged [string]

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

Filter by
Sorted by
Tagged with
10
votes
25answers
2k views

Let's play tennis 2: east-west game

There is a challenge Let's play tennis by Daniel. He proposes to place a court in the North-South direction. My proposal is to create a court to play tennis in the East-West direction too. You ...
5
votes
57answers
2k views

String analyser

Use any programming language to display "AWSALILAND" in such a way, so that each letter is in a new line and repeated as many times as its position in the English alphabet. For example letter, (A) ...
6
votes
5answers
300 views

Japanese pitch accent numbers

Your challenge is to turn a Japanese word and a dictionary pitch accent number into a new string where the rises and falls in pitch are marked: e.g. (2, ウシロ) → ウ/シ\ロ...
23
votes
26answers
3k views

Print a Wavy String Line-by-Line

Challenge Write a program or function that takes in a string s and integer n as parameters. Your program should print (or ...
18
votes
34answers
3k views

Text compression

With the given text below, there are some words in the text that repeats several times in the text. Use any programming language to write a short code that compresses the text to display it. Or in ...
2
votes
11answers
375 views

Cycle my input please [duplicate]

Input A string s of printable ASCII characters, newlines, and spaces (0x20 ( ) to 0x7E (~)),...
1
vote
2answers
166 views

Accordion Solitaire: Which First Moves Can I Make?

Introduction: Unfortunately an Accordion Solitaire Solver challenge already exists (Solve a game of Accordion), so instead this easier related challenge. Let's start by explaining how Accordion ...
33
votes
24answers
6k views

Can the number be split into powers of 2?

Yesterday while playing with my kid I noticed the number in his toy train: So we have $$4281$$ that can be split into $$4-2-8-1$$ or $$2^2-2^1-2^3-2^0$$ So simple challenge: given a non-negative ...
20
votes
15answers
5k views

One line Keyboard

The Challenge The goal of this challenge is to determine whether a given String can be typed using only one line of a standard UK QWERTY keyboard. This is ...
18
votes
8answers
3k views

Ternary-if Converter

In Java/.NET/C/JavaScript/etc. you can use ternary-ifs to shorten if-statements. For example (in Java): ...
33
votes
37answers
5k views

Be there, for the square [duplicate]

Sometimes when you're lying in bed and reading a message, your phone screen will pop into landscape mode right in the middle of a sentence. Only being able to read left to right, you find yourself ...
17
votes
4answers
751 views

You are given a string to make and starting with the empty string, make it using appending and cloning cost

Your task is to create the given target string. Starting with an string that is empty, you will have to add characters to it, until your string is the same as the one we want. You can either add a ...
15
votes
16answers
1k views

Supreme Sum String

Supreme Sum String Given an input string, return the word with the highest sum of each of its unicode characters. Rules The input should be seperated by whitespace The value of each word is based ...
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
184 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
705 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
535 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
7answers
489 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: ...
50
votes
65answers
18k 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, ...
32
votes
19answers
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 ...
46
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
223 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 ...
39
votes
41answers
8k 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
120 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
156 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 ...
52
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
366 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
880 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
711 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
24answers
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. ...
36
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 ...
22
votes
43answers
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
784 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 ...
31
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 ...
10
votes
26answers
2k 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 ...
18
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
123 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
187 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
191 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 ...
20
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
3k views

Alternating Pattern

In a now deleted stackoverflow question, someone posted the following: Write a program or function to print alternating patterns in * and ...
17
votes
31answers
2k 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 ...