#C11965. Swap the Middle and Suffix Parts
Swap the Middle and Suffix Parts
Swap the Middle and Suffix Parts
You are given three strings, each in the format X-Y;Z
, where X
, Y
, and Z
are non-empty alphanumeric strings. The string contains exactly one hyphen (-
) and one semicolon (;
) where the hyphen always comes before the semicolon.
Your task is to swap the part immediately after the hyphen (Y
) with the part after the semicolon (Z
). Formally, if a string is of the form
\[
s = X - Y; Z,
\]
then you should output
\[
X - Z; Y.
\]
Each input consists of three such strings. Print the transformed strings in the same order as the input, each on a new line.
inputFormat
The input consists of exactly three lines. Each line contains a single string in the format X-Y;Z
where X
, Y
, Z
are non-empty alphanumeric strings. It is guaranteed that each string contains exactly one hyphen -
and one semicolon ;
, with the hyphen appearing before the semicolon.
outputFormat
Output three lines, each containing the transformed string after swapping the segment between the hyphen and semicolon with the segment after the semicolon. In other words, if the input string is X-Y;Z
, then output X-Z;Y
.
abc-def;ghi
jkl-mno;pqr
stu-vwx;yz
abc-ghi;def
jkl-pqr;mno
stu-yz;vwx
</p>