#266. 字符串中间插入
字符串中间插入
String Insertion
Background
Congcong is learning string manipulation. He wants to try embedding a word into the middle of another string.
Problem Description
Given an "out" string of length 4, such as "<<>>", and a word, return a new string where the word is in the middle of the out string, e.g., "<<word>>". Note: use str.substring(i, j) to extract the String starting at index and going up to but not including index .
Input Format
Input is given from Standard Input in the following format.
out_strwordThe first line contains two strings,
out_str(the 4-character "out" string) andword(the word to insert), separated by a space.
Output Format
Output is to Standard Output in the following format.
The new string with
wordinserted into the middle ofout_str.
Sample
<<>>" "Yay
"<<Yay>>"
<<>>" "WooHoo
"<<WooHoo>>"
[[]]" "word
"[[word]]"
Sample Explanation
For the first sample, the out string is "<<>>" and the word is "Yay". Inserting "Yay" into the middle of "<<>>" results in "<<Yay>>".
Constraints
Time limit: 1 second, Memory limit: 1024KB.