Compound words

Report a typo

Suppose you have a simple Go program that takes as an input two random strings. Your task is to concatenate the two strings together into the word variable, and then print word, followed by its length.

Tip: Remember you can use the len function to get the byte length of a string!

Sample Input 1:

Salt water

Sample Output 1:

Saltwater 9
Write a program in Go
package main

import "fmt"

func main() {
// DO NOT delete the code block below, it takes as an input 2 random strings
var a, b string
fmt.Scanln(&a, &b)

word := ? // concatenate a and b here!
fmt.Println(?, ?(?)) // print 'word' followed by its length here!
}
___

Create a free account to access the full topic