Given an “out” string length 4, such as “<<>>”, and a word, return a new string where the word is in the middle of the out string, e.g. “<>”





Following are the test cases

Test cases Result Status
makeOutWord(<<>>,Yay) <<Yay>> OK
makeOutWord([[]],Word) [[Word]] OK
makeOutWord([((JAVA))] ((JAVA)) OK

Java solution


package test;

public class Program17 {
	public static void main(String[] args) {
		Program17.makeOutWord("<<>>", "Yay");
		Program17.makeOutWord("<<>>", "WooHoo");
		Program17.makeOutWord("[[]]", "word");
	}
	public static String makeOutWord(String out, String word) {
		return out.substring(0, 2) + word + out.substring(2,4);
	}
}

Javascript solution


const makeOutWord = (out, word) => {
    return out.substr(0, 2) + word + out.substr(2, 4);
}

console.log(makeOutWord("<<>>", "Yay")); //<>
console.log(makeOutWord("<<>>", "WooHoo")); //[[Word]]
console.log(makeOutWord("[[]]", "word")); //((JAVA))




Our Best Partners: melhores horarios fortune rabbit https://luckyjetslots.com/uz/ https://slot-pgsoft.com/gemstones-gold/ online casinos that accept checks Crazy Time Rules what is lucky jet fortune rabbit melhor horário how to predict the lucky jet Lucky Jet Predictor Online 2024 minuto pagante fortune mouse

Bushan Sirgur

Hey guys, I am Bushan Sirgur from Banglore, India. Currently, I am working as an Associate project in an IT company.

Leave a Reply