#K91157. Decipher the Message
Decipher the Message
Decipher the Message
You are given a string (s) and a delimiter (d). The task is to reverse the order of the substrings (words) that are separated by the delimiter and then join them back together using the same delimiter. If the delimiter does not appear in (s), simply return (s) unchanged. For example, if (s = \text{'hello|world|this|is|a|test'}) and (d = |), then the output should be (\text{'test|a|is|this|world|hello'}).
inputFormat
The input consists of two lines. The first line contains the string (s) and the second line contains the delimiter (d). Note that (s) may contain zero or more occurrences of (d).
outputFormat
Output a single line containing the transformed string after reversing the order of the words separated by the delimiter.## sample
hello|world|this|is|a|test
|
test|a|is|this|world|hello