String builder with Unicode characters

Report a typo

Lena has created a small Go program that takes as an input a Unicode character and then uses the strings.Builder type and one of its Write helpers to concatenate the Unicode character 3 times.

Unexpectedly, when she executed her program she didn't get the expected output... can you fix the errors in Lena's code so it can properly concatenate Unicode characters?

Sample Input 1:

3486

Sample Output 1:

ඞඞඞ
Write a program in Go
package main

import (
"fmt"
"strings"
)

func main() {
var builder strings.Builder

var c byte // what type allows us to read Unicode characters?
fmt.Scanln(&c)

for i := 0; i < 3; i++ {
builder.WriteByte(c) // what function allows us to write Unicode characters?
}

// This line outputs the Unicode character do not delete it!
fmt.Println(builder.String())
}
___

Create a free account to access the full topic