Questions tagged [string]

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

Filter by
Sorted by
Tagged with
29
votes
14answers
2k views

Is it a digit haiku?

We can read 13576870234289 digit-by-digit in English, and it makes a haiku: one three five seven six eight seven zero two three four two eight nine We say it's a &...
-6
votes
0answers
102 views

palindrome in lua [closed]

I have written a code for palindrome in lua but the code says it is not a palindrome if there is a capital letter in the string tc = tonumber(io.read()) for i=1,tc do ...
8
votes
2answers
146 views

Unscramble the letters by letter frequency analysis [closed]

You know those riddles where every letter is swapped for another letter? E.g. you get a text like ...
12
votes
8answers
2k views

We're much closer than you think

Martin Ender's 2D programming language Alice has two different modes depending on what orientation the IP has: orthogonal (Cardinal mode) or diagonal (Ordinal mode). Commands in Alice change their ...
13
votes
20answers
2k views

Create an Accurate How-To Article

Here is an easy-intermediate challenge for anyone interested! What is that? A thing me and brother do a bit too often is this: One of us has a problem and asks the other to explain how to do certain ...
22
votes
13answers
2k views

Decide a C integer literal

Objective Given an ASCII string, decide whether it is a valid C integer literal. C integer literal A C integer literal consists of: One of: 0 followed by zero or ...
20
votes
42answers
3k views

Converting Strings to Decimals (Gone Wrong)

What? Many programming languages, both practical and esoteric, have functions, methods, etc to convert a given string to a decimal number. This is how the process might work: For each character in ...
10
votes
6answers
542 views

Parse a Scala expression

Scala isn't a very commonly used language around here. Most of those who know it like it[citation needed], but some go :\ when they encounter its user-defined ...
19
votes
16answers
2k views

Size up a number

Intro Given a whole number \$< 100,\$ extend/shorten the english representation of the number to have as many characters as it's value. Sandbox Rules Take the number \$n\$, and get it in words ...
14
votes
15answers
2k views

Palindrome distance

Find what is the distance for a given string to its closest palindrome of the same length. For this task I decided to give the characters further away from the string's center more weight (think of it ...
2
votes
4answers
415 views

Parse a nested parentheses

Objective Mimic Haskell's reads :: ReadS (). Or in other words, parse nested parentheses. Since the target type is () (the type ...
16
votes
27answers
2k views

Compactify the query string

Introduction Just on Hacker news, John Resig contemplates transforming a query “foo=1&foo=2&foo=3&blah=a&blah=b” into one that looks like this: “foo=1,2,3&blah=a,b", https://...
20
votes
23answers
1k views

Find the result of some assignment statements

In this challenge, the goal is to find the values of some variables after a number of assignments are done. An example input: a = 5 b = 4 c = a = b a = 2 b = a ...
26
votes
32answers
4k views

I uppercase the source code, you reverse the input!

It's one of these again :D Your task, if you wish to accept it, is to write a program/function (without any uppercase letters) that outputs/returns its string input/argument. The tricky part is that ...
11
votes
12answers
4k views

Is this a robbery?

Backstory You own a tiny jewellery shop in the suburbs of the city. The suburbs are too much overpopulated, so your shop has a thickness of only one character to fit in the busy streets. Recently, ...
14
votes
35answers
1k views

Lolololololololololololol

Let us take a break from the brain-wrecking questions and answer some of the simpler ones You have recently read something extremely funny, and want to express your laughter to the world! But how can ...
16
votes
37answers
1k views

Divisible strings

Task Given a string s, output a truthy value if the ASCII code of each letter is divisible by the length of s, and a falsey ...
18
votes
6answers
2k views

Surround a string with “friendliness pellets”

Input a String and surround it with a rounded rectangle of alternating "friendliness pellets".(0) Sandbox Idea originally from Lyxal. Challenge Given a ...
8
votes
4answers
213 views

Find the index of reflection of a substring of a palindrome [closed]

Problem Statement: You will receive a substring of a palindromic string. You must return the index of the substring which marks the point of reflection of the original string. You are only provided ...
12
votes
19answers
1k views

Repeating pattern of empty lines

Write the shortest program or function that takes some text as input, and outputs either it or an empty line in a repeating pattern: ...
11
votes
7answers
587 views

De-interleave log lines: HARD MODE

In the face of some regrettable rules that turned the original into a glorified sorting task, I am posting a more challenging variant. Shout out to Luis Mendo for the suggestion of how to improve the ...
-6
votes
13answers
252 views

Number chopping: Split a number into its digits [closed]

Number Splitting Instructions Oh no, my numbers have stuck together! Luckily, we can split them apart with code. Your code should be a function that takes an integer input from stdin or as an argument....
11
votes
8answers
1k views

Let's Decrypt It!

Note This is the decryption challenge. The encryption challenge can be found here. Challenge The challenge is to decrypt a given string, using the rules as specified below. The string will only ...
18
votes
13answers
2k views

Case invert your quine

Write a quine which attempts to invert the case of as many ascii characters in the source code as possible. For example in javascript: ...
25
votes
6answers
1k views

Build an alphabetised polyglot

As TIO can show, every letter of the Latin alphabet is represented when it comes to languages. For every letter there is at least 1 programming language whose name begins with that letter. Your task ...
17
votes
21answers
2k views

De-interleave log lines [duplicate]

You've inherited a server that runs several apps which all output to the same log. Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that ...
11
votes
11answers
643 views

Remove partial matching duplicate lines and retain longest line

Write the shortest possible program to remove all partial matched duplicates from a list and only retain the longest lines. Sort order does not matter. For following inputs, the intent is to search ...
13
votes
21answers
1k views

Mode length of a sentence

The task is simple. You are given a string with alphabetical words (say "Hello world, this are tests"). You have to return the mode of the lengths of ...
31
votes
84answers
8k views

Print X without X (robber's thread)

This is the robber's thread of a cops-and-robbers challenge. You can view the cop's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do ...
52
votes
90answers
9k views

Print X without X (cop's thread)

This is the cop's thread of a cops-and-robbers challenge. You can view the robber's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do ...
16
votes
20answers
3k views

And and… and. And.?

Introduction: Inspired by the Puzzling-stackexchange post with the same name, which I've answered four years ago: Can you create a perfectly valid English sentence, which makes perfect sense, but ...
24
votes
61answers
6k views

Average of your code

Inspired by this Task Your task is to output the average character of your code. What is an average character? Say we have a string golf(). We then take the ASCII ...
21
votes
21answers
3k views

XOR two strings

Given two strings as input, return the result of XORing the code-points of one string against the code points of the other. For each character in the first input string, take the code-point (e.g. for <...
12
votes
4answers
525 views

Writing erasable code

My phone number (which I will not be sharing here) has a neat property where there is a two digit number, which when iteratively removed from my phone number will eventually remove all the digits. ...
23
votes
2answers
2k views

Get string “-” with JavaScript using only the symbols from “+[]”

Challenge: Get the JavaScript string value containing only the "-" character using code only containing the following three symbols: ...
30
votes
24answers
3k views

Print a tongue twister!

The goal of this challenge is to print the following tongue twister: ...
2
votes
2answers
172 views

Create a text image by manual automation

Challenge Premise It's 2006, and Alice is trying to send Bob their her completed notes on their newly ended expeditions into the labyrinthine school library, which the two of them found suffers from a ...
16
votes
28answers
2k views

Turn a sentence into a dictionary

For this challenge, you will be given a long string as an input. With this string, you must create a dictionary. Details: This dictionary will contain all the words from the string - a word being any ...
0
votes
2answers
181 views

Remove each integer from a string and multiply them all! [closed]

Goal: Get every integer from the string (not a number, but integer) Multiply them Output the result Input: 5 kilograms of food eaten, 10 liters of water drank, 20 plates dirty, 40 mugs dirty, and ...
21
votes
20answers
1k views

Shortlex predecessor

Please note the special scoring for this challenge. Given a non-empty string made of a-z, output the string immediately before it in the shortlex order. Shortlex ...
8
votes
1answer
95 views

Determine if a substructure is present in a chemical structure using SMILES string (substructure fingerprint)

A SMILES (Simplified molecular-input line-entry system) string is a string that represents a chemical structure using ASCII characters. For example, water (\$H_2O\$) can be written in SMILES as ...
13
votes
31answers
1k views

Special String reformatting

This challenge is to take an alphabetical string as input and to apply the following conversion: The first of each type of character of the string must stay, and must be immediately followed by an ...
10
votes
13answers
1k views

Is this a half-sort?

The problem over here introduces an new type of strings: if you split the string into equal halfs and swap the pairs, it produces the same output as sorting the string. We call that a half-sort. ...
2
votes
3answers
280 views

Checking a Windows 95 OEM Key for validity [closed]

Introduction Windows 95 used a very simple algorithm for verifying license keys. The scheme of an OEM license key always looked like this: xxxyy-OEM-NNNNNNN-zzzzz ...
14
votes
29answers
2k views

Shift the letters, soldier?

Context We're at war! You need to transfer an important message to your general to inform them from an imminent assault. The thing is, your enemy knows a lot about cryptography : you will need to be ...
27
votes
29answers
3k views

Determine the Sharpness of a Word

Overview The sharpness of a word is the sum of the sharpness of each of its letters, using the following rules: Sharp letters A, and ...
25
votes
11answers
3k views

Make true and false global!

We all know true and false, but what do speakers around the globe say? ...
26
votes
11answers
3k views

Your code has an uncanny mirror twin…

Write two programs, each taking a string s and a number n ≥ 0, such that: The first program prints ...
-2
votes
2answers
156 views

Get a middle-ish string [closed]

You are the first engineer in a hot new startup, Lexographical. Our company is making waves by digitizing and indexing all words, real or not. The core of our product... Our secret sauce... Well, that'...
11
votes
10answers
1k views

Cheat activated

Background The game Grand Theft Auto: San Andreas went down in history also thanks to its wide selection of cheats. They're almost 90 and anyone who has ever touched this game, no doubt has tried ...

1
2 3 4 5
37