#287. 条件拼接字符串

    ID: 287 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatString-1gesp3字符串条件结构

条件拼接字符串

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 S1S1 and S2S2 are two strings, separated by a single space. S2S2 can be an empty string.

Output Format

Output is printed to standard output in the following format.

Result

Where ResultResult is the concatenated string.

Sample

abc cat
abcat
dog cat
dogcat
abc 
abc

Sample Explanation

Sample 1: The first string is "abc\