#287. 条件拼接字符串
条件拼接字符串
String Concatenation
Background
In the world of programming, string operations are fundamental and common tasks. Congcong has recently been learning how to concatenate two strings and has encountered some special cases.
Problem Description
Given two strings, append them together (known as "concatenation") and return the result. However, if the concatenation creates a double-character (i.e., the last character of the first string is the same as the first character of the second string), then omit one of the characters. For example, concatenating "abc" and "cat" yields "abcat".
Input Format
Input is given from standard input in the following format.
S1 S2
Where and are two strings, separated by a single space. can be an empty string.
Output Format
Output is printed to standard output in the following format.
Result
Where is the concatenated string.
Sample
abc cat
abcat
dog cat
dogcat
abc
abc
Sample Explanation
Sample 1: The first string is "abc\