# Questions tagged [string]

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

1,894 questions
Filter by
Sorted by
Tagged with
735 views

### Random Move 2x2 Scrambling

A simple way to scramble a 2x2x2 Rubik's cube is to make a sequence random moves. This is not how official scrambles are done, but can get pretty close to a uniform distribution of all possible ...
904 views

### Implement swap encoding

Swap encoding is an encoding method where you iterate through a string, reversing sections of it between pairs of identical characters. The basic algorithm For each character in the string: Check: ...
236 views

### CDGLF: TMN to APL

In this challenge you will remove one of my least favorite features, operator precedence from traditional math notation, to acheive the syntax of one of my favorite languages, APL. The APL subset we ...
2k views

### I before E, except after C

You may be aware of the famous old rhyme, "I before E, except after C". It is a rule taught to aid in the spelling of certain English words. Quoting Wikipedia: If one is not sure whether a ...
270 views

### Help me count the Omer

During the 49 days between Passover and Pentecost, Jewish liturgy provides four numerical problems that I've here phrased as code golf problems. Input/Arguments These four, in any order, and by any ...
2k views

### Help me get the day of the week correct

Sometimes, I will think it is one day of the week (e.g Friday) when in reality, it's earlier in the week (e.g Tuesday). Your challenge is to display the number of days my estimates are off by. ...
672 views

### Convert superscripts to MathJax

CGCC hasn't always had MathJax. Back in the dark ages, it would have been necessary to write $x^2$ as (the horror!). In this challenge, you will be given some ...
3k views

### Did I die or not?

Given a permutation of the alphabet and an intended "word", determine if the word was guessed in a game of Hangman, where the permutation is the list of guesses. For example, given ...
1k views

### Reversencode the given string

Given a string, if it is even, break the string into 2 even parts, then reverse the parts to get the "reversencoded" string. Example: onomatopoeia -> tamonoaieopo If the string is not of ...
212 views

### Golfing Expressions

We can write mathematical expressions using the standard math operators (,),+,...
196 views

### Interpret control characters like a terminal

Given a ASCII string containing control characters, compute what it should look like when printed to a terminal. Imagining the behaviour of a cursor, this is how to treat each character in the input: ...
245 views

### Matching homologous groups

Homologous series, any of numerous groups of chemical compounds in each of which the difference between successive members is a simple structural unit. As an example, Alkane is a homologous group ...
9k views

### R.E.P.A.I.R. T.H.E. K.E.Y.B.O.A.R.D

Sequel of this AWESOME challenge You, a genius tech prodigy detective, have successfully disarmed the bomb and want to break into the computer. The police found the password ...
122 views

### Repeating terms of a given sentence [closed]

Program Write a program to display repeating terms of a given sentence. Explanation The program must output the repeating terms of two or more letters from the given input (input is a sentence ...
1k views

### Variable length Fibonacci word

Challenge For any two non-empty strings A and B, we define the following sequence : F(0) = A F(1) = B F(n) = F(n-1) + F(n-2) Where ...
503 views

### Outsmart the boffins at New Scientist (string rotation)

The brainiacs at New Scientist tweeted this morning that "The word STABLE has the neat property that you can cycle the first letter to the end to make a new word: TABLES. And you can do it again ...
2k views

### Overwrite a string on a tape

Take the string abcdfghjk. To overwrite it, starting from f, with the string wxyz, you would ...
2k views

### Calculate longest Stack Exchange streak

Introduction This challenge is inspired by the Meta Stack Exchange question The longest consecutive days streak; it turns out that the URL ...
162 views

### Pretty printing JSON

I want format a JSON string into human-readable form. A string like this: ...
222 views

### (Σ*)² ⟲ Σ* (Round-Trip a String Pair)

We're back! And this time with an objective scoring criteria! This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a ...
465 views

### What's my TIO uniqueness?

Try it online! currently has 680 listed languages, all of which are searchable. For most of those languages, when searching for it, you don't have to enter the entire string. For example, entering <...
2k views

### Un-pipe an Elixir expression

Elixir is a programming language with a feature called the pipe operator, |>, similar to the pipe in Bash and other languages. It passes the result of an ...
461 views

### (Σ*)² ⟲ Σ* (aka Round-Trip a String Pair) [closed]

This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a perfect fit for the creativity of PPCG users :) Your Task Define two ...
1k views

### Decode Polybus Square/Tap Code/Prison Code

The code has a lot of names, but is very simple: 1 2 3 4 5 1 A B C D E 2 F G H I J 3 L M N O P 4 Q R S T U 5 V W X Y Z A letter is coded by its coordinates, ...
747 views

274 views

### Find the Best Set of Adapters

I'm trying to plug this really old phone into my computer but the phone seems to use a very obscure plug. Luckily I have some adapters. Unfortunately, I can't figure out which of them to use to ...
283 views

Commentscript is a variant on Javascript that I made up for the purpose of this question. Only commented-out code is evaluated. Javascript has two types of comments: ...
3k views

### Find the HTTP status code

Given the name of an HTTP status code, such as OK or Continue, output or return the corresponding number. Your code is limited ...
231 views

### Reverse source code and double the input

For today's challenge you have to take an input, and if your source code is reversed, then the input should be printed doubled. Let's say your source code is ABC ...
2k views

### Alphabet printing challenge

This challenge is related Challenge Your task is to write as many programs/snippets as you can, where each one outputs/prints/ returns an alphabet. The first program must output the letter ...
1k views

### Autogrammatic pairs

For today's task, we have two programs, P and Q, both in the same language. Each of them receives a single-character input. If P receives character K, P says how many times K appeared in Q. (You can ...
641 views

### Convert Gemtext to HTML

Gemtext is a very simple markup format used by the alternative web protocol Gemini. Write a Gemtext to HTML converter. From the Wiki: A line of text is a paragraph, to be wrapped by the client. It is ...
3k views

### Pangram “Hello, World!”

Your challenge: The code must print "Hello, World!" and nothing else. Your restrictions: Your program must satisfy these requirements: The program must be a pangram. It must use every ...
2k views

### BalancE the UppercasE

Oh, No! the sentences are out of balance. Quick! balance them. A word is defined as follows: A sequence of letters [A-Za-z] separated by any non-letter character ([0-9] ~+- etc.) A word is BaLanCeD ...
119 views

### Is this an anagram of its own source code? [duplicate]

I like anagrams. I like programs that reference their own source code. So this challenge combines them! Input. The input to the program could be anything, including letters, numbers, symbols, you name ...
193 views

### Generating minimal regular expression character classes

Background Character classes are a standard way to indicate a set of characters to match in regular expressions. For example, the class [ab] matches a or b, ...
2k views

### Make a !!!Batch compiler/translator

!!!Batch is another derivative of the Windows Batch programming language, its wiki is here Your challenge is to create an compiler/translator that reads a !!!Batch program and returns a Windows Batch ...
239 views

### Write A Book Cipher [closed]

Introduction Book cipher A Book cipher is a very unique method of a encipher. Here's how's it done: You have a book / a document or a article (something full of text, the more pages of text the ...
305 views

802 views

### Count strictly overlapping substrings

Given two strings a and b, count how many times b occurs as a substring in ...
3k views

### How likely is this mutation?

In my previous bioinformatics challenge, I asked you to mutate a DNA sequence. This time, I'd like you to evaluate how likely a mutation, or a series of mutations, is. The two types of substitutions ...
5k views

### Which Ninjutsu am I casting?

In the MMORPG Final Fantasy XIV, the Ninja class has the ability to use combinations of up to three handsigns (Ten, Chi and Jin) to perform a variety of ninjutsu skills. The skill you cast depends on ...
2k views

### Evaluate left-or-right

Originally sandboxed by @xnor Left-or-right is a very simple language @xnor made up. Its expressions are made of arrows < (left), ...
524 views

### Implement bottom (encode)

Challenge The challenge is to implement the bottom encoding (only encoding, not decoding). There is a wide variety of existing implementations in the bottom-software-foundation org. Bottom is a text ...