Questions tagged [string]

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

Filter by
Sorted by
Tagged with
24 votes
18 answers
2k 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 ...
user avatar
  • 10.9k
9 votes
1 answer
171 views

Are We Fast And Furious? [closed]

There are currently nine feature length films in the core Fast & Furious/The Fast and the Furious media franchise, a series of films about bald men scowling and driving cars very fast. The names ...
user avatar
17 votes
14 answers
971 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: ...
user avatar
10 votes
1 answer
275 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 ...
user avatar
  • 1,430
26 votes
5 answers
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 ...
user avatar
  • 17.6k
11 votes
3 answers
344 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 ...
user avatar
  • 27.6k
25 votes
24 answers
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. ...
user avatar
  • 21.6k
19 votes
17 answers
735 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 ...
user avatar
18 votes
19 answers
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 ...
user avatar
17 votes
23 answers
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 ...
user avatar
17 votes
1 answer
535 views

Golfing Expressions

We can write mathematical expressions using the standard math operators (,),+,...
user avatar
  • 271
9 votes
3 answers
282 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: ...
user avatar
  • 20.7k
7 votes
5 answers
260 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 ...
user avatar
  • 11.9k
31 votes
23 answers
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 ...
user avatar
  • 11.9k
4 votes
3 answers
133 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 ...
user avatar
  • 243
13 votes
11 answers
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 ...
user avatar
11 votes
5 answers
520 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 ...
user avatar
23 votes
26 answers
2k views

Overwrite a string on a tape

Take the string abcdfghjk. To overwrite it, starting from f, with the string wxyz, you would ...
user avatar
19 votes
3 answers
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 ...
user avatar
-2 votes
5 answers
188 views

Pretty printing JSON

I want format a JSON string into human-readable form. A string like this: ...
user avatar
7 votes
5 answers
233 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 ...
user avatar
  • 699
14 votes
2 answers
485 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 <...
user avatar
24 votes
27 answers
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 ...
user avatar
  • 2,949
10 votes
5 answers
509 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 ...
user avatar
  • 699
25 votes
27 answers
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, ...
user avatar
12 votes
15 answers
787 views

Check if B is composed of substrings of A of length n

Given two strings \$ A \$ and \$ B \$ and a positive integer \$ n \$, determine whether \$ B \$ is composed entirely of (possibly overlapping) strict substrings of \$ A \$ of a length of at least \$ ...
user avatar
  • 20.7k
27 votes
34 answers
3k views

Rotate brackets until they're balanced

Take the string of brackets ]][][[. When you rotate it to the right once, you get []][][. If you rotate it again, you get ...
user avatar
4 votes
6 answers
455 views

I Rot-13 the source code, you Rot-19 the output!

This is alternate of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its ...
user avatar
  • 1,367
20 votes
24 answers
3k views

I palindrome the source code, you palindrome the input!

This is a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/args. The tricky ...
user avatar
  • 1,367
-5 votes
17 answers
352 views

Inverse Ax+B/Cx+D sized function

Let's assume that $$ f(x) = \frac{Ax+B}{Cx+D} $$ Where, \$x\$ is a variable and \$A\$,\$B\$,\$C\$,\$D\$ are constants. Now we have to find out the inverse function of \$f(x)\$, mathematically \$f^{-1}(...
user avatar
  • 11.9k
8 votes
7 answers
289 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 ...
user avatar
  • 1,131
10 votes
1 answer
304 views

Compile Commentscript

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: ...
user avatar
35 votes
18 answers
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 ...
user avatar
-13 votes
15 answers
285 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 ...
user avatar
11 votes
15 answers
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 ...
user avatar
  • 11.9k
13 votes
10 answers
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 ...
user avatar
15 votes
6 answers
879 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 ...
user avatar
23 votes
10 answers
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 ...
user avatar
  • 323
26 votes
21 answers
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 ...
user avatar
0 votes
0 answers
134 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 ...
user avatar
  • 323
11 votes
1 answer
220 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, ...
user avatar
  • 2,919
17 votes
12 answers
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 ...
user avatar
  • 11.9k
3 votes
5 answers
257 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 ...
user avatar
-9 votes
5 answers
474 views

Print your username by ONLY using the characters in your username [closed]

You have to print out your username, by only using the characters in your username. Standard loopholes are forbidden This is not code-golf, so shortest does not win Don't modify your username please ...
user avatar
  • 11.9k
19 votes
13 answers
935 views

Count strictly overlapping substrings

Given two strings a and b, count how many times b occurs as a substring in ...
user avatar
  • 20.7k
17 votes
17 answers
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 ...
user avatar
  • 583
20 votes
12 answers
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 ...
user avatar
38 votes
31 answers
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), ...
user avatar
  • 62.6k
10 votes
8 answers
587 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 ...
user avatar
  • 717
10 votes
15 answers
1k views

Merge Two Paragraphs with Removing Duplicated Lines

Challenge The goal of this challenge is to make a function that takes two paragraphs and output a concatenated result with removing the duplicated overlapped lines due to redundancy (but a single copy ...
user avatar
  • 403

1 2 3
4
5
42