Questions tagged [string]

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

Filter by
Sorted by
Tagged with
11
votes
18answers
1k views

Mirror and reverse text

Inspired by I reverse the source code, ... Your task, if you wish to accept it, is to reverse text and mirror select characters. Yes, yes, I know. Very surprising. Input A string, ...
21
votes
31answers
4k views

How happy is this emoticon?

In this challenge, submissions will be programs or function which, when given an emoticon such as :-), :(, or ...
18
votes
13answers
2k views

Let's decompress a bit

Given a compressed string \$s\$ made of printable ASCII characters (32 to 126), your task is to print or return the original text by applying this simple decompression algorithm: Start with \$k=0\$ ...
35
votes
13answers
6k views

God is real . . . unless declared integer

This challenge is inspired by Fortran's idiosyncratic implicit typing rules. Your task will be to determine the data type of the object GOD according to the ...
23
votes
18answers
2k views

Cook me a character meal

Chef Avillez is about to cook us some really nice meal. He is just waiting for us to give him some ingredients and to request a meal. Task Given a list of ingredients (strings matching ...
17
votes
20answers
2k views

Pendulum Encoding

Given a string as an input (which can be any acceptable/convenient format in your language), implement pendulum encoding. The test cases are split into individual items (which aren't quoted) for a ...
12
votes
9answers
522 views

Simulate D Flip-Flop

Objective Simulate an edge-triggered D Flip-Flop. What is D Flip-Flop? A D flip-flop is an electronic digital device that outputs an inputted data (abbr. D) with synchronization to a clock (abbr. ...
21
votes
33answers
2k views

Vowels up, consonants down

Challenge You will be given a string that can contain lowercase letters, uppercase letters, or spaces. You have to turn the vowels (a, e, i, o, u) in the string to upper case and consonants to lower ...
40
votes
28answers
4k views

Name your novel disease

Introduction The current coronavirus disease is officially named COVID-19, from the 3 words corona virus disease, and the year 2019. (Technically it's coronavirus, making 2 words, but whatever...) ...
13
votes
9answers
533 views

Smaller Strings in Printable ASCII base

Task Given a input string s which contains only printable ascii characters output all strings which contain only printable ascii characters and are strictly ...
13
votes
6answers
557 views

Calculate the average longest common substring exactly

[Question inspired by Can you calculate the average Levenshtein distance exactly? . Thank you Anush. ] The longest common substring between two strings is the longest substring which is common to ...
5
votes
5answers
418 views

Special Character Coding Challenge - Check string for validity (Lots of rules) [closed]

There are 5 different "special characters": % & # $ ! These special characters are in a string with numbers. Like so: "5 ! 60%2$5.3" (valid). You must determine the validity of the string and ...
14
votes
23answers
2k views

The SBEVE Challenge

She said s(he) be(lie)ve(d), he said sbeve. Input A non-empty string, s. It's guaranteed that s will have only printable ASCII ...
-4
votes
13answers
288 views

Convert a string to upper case without using built in methods/functions [closed]

Challenge You will be given a string as an argument. You need to convert that string to upper case. But you can't use any built in method or function nor any external programs. Rule No use of ...
33
votes
18answers
6k views

Bad factorial joke

Sometimes I make bad jokes... And a bad joke I like to make involves interpreting exclamation marks in sentences as the factorial sign. Task Your task is to write a program that receives a sentence ...
22
votes
27answers
5k views

When I grow up I want to be ASCII

Task Your task is to take a character in: AÁÀÃÂBCÇDEÉÊFGHIÍJKLMNOÕÓÔPQRSTUÚVWXYZaáàãâbcçdeéêfghiíjklmnoõóôpqrstuúvwxyz and turn it into a characters in: ...
27
votes
27answers
3k views

(RGS 3/5) Help me write Portuguese!

Context (Feel free to skip, doesn't really matter for the algorithmic explanation of the task) European Portuguese is a fairly complicated language to learn, mostly because of its grammar. One ...
-6
votes
3answers
240 views

Determine the Kth character in the concatenated string

You are given a list that contains \$N\$ strings of lowercase English alphabets. Any number of contiguous strings can be found together to form a new string. The grouping function accepts two integers ...
22
votes
78answers
8k views

Scream very loudly

Write a script that outputs A to stdout infinitely. There shold be no newlines or seperators between the characters Standard loopholes apply This is code-golf. ...
20
votes
41answers
2k views

(RGS 2/5) How many strings can you count within these character classes?

Task Given a string composed of ASCII printable characters, return how many strings could fit the given pattern with character literals and regex-like ranges. Pattern string The pattern string ...
3
votes
5answers
232 views

String-wise calculus (i)

This will turn into a series involving other aspects of calculus, including using the "derivative" of a string to find "stationary points" etc, as well as "integration" of sentences Introduction If ...
29
votes
41answers
6k views

Is it really time?

A time in the format hhMMss is represented by six numbers in the range 0..9 (e.g.100203 for 3 seconds after 2 minutes after 10am (10:02.03), or ...
7
votes
18answers
841 views

Put in the quotes

Background There's a terrible problem in my console - the quotes never get included inside the arguments! So, when given this argument: ["abc","def","ghi","jkl"] ...
4
votes
12answers
411 views

Creating words by structure

Context As a conlanger, I am interested in creating a uniform, naturalistic language. One of the tricks is to create vocabulary according to certain structures of words. An example from English: In ...
14
votes
10answers
2k views

Visualize a Recursive Acronym

Background Famously, the acronym GNU stands for GNU's Not Unix. 1 It's recursive because, after expanding it once, it still ...
23
votes
21answers
4k views

The most common substring

The purpose of this task is to write a program or function to find the most common substring within a given string, of the specified length. Inputs A string, s, ...
0
votes
0answers
56 views

code-bowlingn't [duplicate]

If you place the suffix n't on any given word, it instantly means the opposite of the intended usage of the word. If you place the word ...
3
votes
7answers
204 views

String permutations

Print the biggest-size subset of strings in the input that are all permutations of each other. If there are ties, any one will do. If no strings are permutations of each other (for example, only one ...
21
votes
17answers
2k views

Answer templating

Context Just look around! Whenever someone posts an answer, the same template is followed over and over again! A first line with the byte count and language name. Then the code. Then the TIO link. ...
2
votes
0answers
107 views

Predictor Generator [closed]

Write a program that when given a string \$S\$, it generates a program of the same language as itself. The generated program, when given a continuous substring of \$S\$, should predict the next ...
4
votes
5answers
302 views

Find the most important character

Find the most important character The challenge is to write a program that outputs the most occurrent character in the input string, excluding these bracketing characters ...
1
vote
1answer
130 views

Name an arbitrary string [closed]

This should be easy: given an arbitrary string, your program will give it a name. Requirements Your program will accept an input of a UTF8 string, and output a string representing the input's "name",...
3
votes
5answers
270 views

Implement a Caesar Cipher with a Digit Shift

I assume everyone here is familiar with the Caesar Cipher that shifts letters to a certain index. https://en.wikipedia.org/wiki/Caesar_cipher for those who still needs introduction. But, we can all ...
27
votes
25answers
2k views

The Magical Piper

An old test for programmers, taken from here (Note: in italian). Along a road (denoted by '_'), there is a Magical Piper (denoted by '...
29
votes
19answers
4k views

Print this maximally long URL

Task This one is simple. We want to compress a URL, but don't trust URL shorteners. Write a program that prints to stdout (or a 0-argument function that returns) the following, working URL: http://...
4
votes
3answers
187 views

Shortest POSIX command line that eagerly removes dual newline sequences

Example: echo -ne 'a\n\nb\nc\n\n\n\nd\n\n\n' | your-command should output the same as echo -ne 'ab\ncd\n' Watch out, some ...
15
votes
26answers
1k views

pleTriwapt Sgpin (Triplet Swapping)

Intro/Background I was looking at a Flybuys card at Coles recently and noticed that if I took something like this: Source, randomly found on the Internet And swapped some words around, I'd get ...
27
votes
66answers
4k views

Repeat every other character in string starting with second character

Requirements: Take a single word as input with only lowercase alphabetical characters (a-z) Output a string where every other character is repeated, with the first repeated character being the second ...
11
votes
1answer
312 views

Write a Whitespace Interpreter

Challenge: Your challenge is to write an interpreter for Whitespace. Given a string consisting of spaces, tabs, newlines, and potential other characters, as well as possible inputs for the Whitespace ...
43
votes
11answers
4k views

Simple Circular Words

A "simple circular" word is a word whose chords do not intersect. The chords of a word may be seen by laying out the alphabet in a circle, and then connecting the word's consecutive letters. ...
19
votes
8answers
2k views

Narcissistic Quine

Write a program/method that: Becomes a quine when the input matches the source code; Doesn't halt otherwise. This is code-golf, so shortest solution wins. Avoid any standard loopholes.
20
votes
19answers
2k views

Super permutations

Super permutations Input: A string The program should loop through all lengths of the input (decrementing one each time), generate all combinations with replacement of the string, then make ...
14
votes
1answer
453 views

Is everything in order?

Challenge: Input: a string, consisting of only printable ASCII characters Output: a truthy/falsey value whether its characters are in alphabetical order (based on their UTF-8 unicode values), from ...
13
votes
4answers
542 views

Keta Bracket Autocompletion

Special thanks to Bubbler and AdmBorkBork for supplying feedback about this challenge Keta (Keyboard tacit — clever naming, I know!) is a golfing language I’ve been working on recently. One of it’s ...
7
votes
1answer
509 views

Average number of strings with Levenshtein distance up to 4

This is a version of this question which should not have such a straightforward solution and so should be more of an interesting coding challenge. It seems, for example, very likely there is no easy ...
2
votes
3answers
197 views

Partial tq interpreter

In this task you are expected to provide a list output given an input tq program. The tq programs will not contain whitespace inside them. What is tq, in the first place? tq is a lazy-evaluated ...
-2
votes
2answers
241 views

Shorten String as Much as Possible [closed]

Introduction In a list of strings, there is a certain length you can shorten strings to before they become indistinguishable. This is a pretty bad explanation, so here is an example. ...
12
votes
4answers
2k views

Can you calculate the average Levenshtein distance exactly?

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. The challenge is to compute ...
6
votes
1answer
580 views

Average number of strings with Levenshtein distance up to 3

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. Given a binary string \$S\$ of ...
28
votes
37answers
2k views

CahartcreS awppnig (Character Swapping)

Intro/Background I was looking at "You Had One Job" pictures lately, and noticed an old favourite of mine: And I said to myself: "I need a program that can generate text like that". So I devised a ...

1
2 3 4 5
36