Write a function that concatenates three strings into one using a special separator. If the separator is not specified, it is a single space.
Suppose you have a standard input.
Concatenate the letters 1, 2, and 3.
Insert a fourth input separator between the characters in 1-2-3.
However, if a specific keyword is entered, it will be output as a half-width space.
The following is my code.
import java.util.*
fun main() {
val scanner = Scanner(System.`in`)
val input = Array(4){scanner.next()}
if (input[3] == "NO SEPARATOR"){
println(" ")
}else{
input[3] == input[3]
}
println("$input[0]$input[3]$input[1]$input[3]$input[2]")
}
//Sample Input
abc
def
ghi
NO SEPARATOR
Sample Output
abc def ghi
I can't think of a solution.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…