index | submit | rank | book

replace – Replacing in a string

Write a program that replaces the character in a given position in a string.

Replacing the character 'a' by 'e' in the string "Hallo"

Each line of input will consist of a string s, a natural number i and a character c.

For each line of input, there should be a line of output with a modified version of string s where the character at position i is replaced by character c.

String s is alphanumeric and is of up to 60 characters. This string is indexed from zero.

0 < |s| ≤ 60

0 ≤ i < |s|

Example Input

Hallo 1 e
Bach 3 k
bitter 1 u

Example Output

Hello
Back
butter

Scoring

try first: index-string

try next: digit-sum

index | submit | rank | book

Copyright © 2020-2022 Rudy Matela
This text is available under the CC BY-SA 4.0 license.
Originally available on cscx.org/replace