865. Concatenate One String to Another

You are given two strings str1 and str2.

Write a program to concatenate str2 to the end of str1, and return the resulting combined string.

Concatenation means joining both strings in their original order.

Example 1:

Input: str1 = "Hello", str2 = "World"

Output: "HelloWorld"

Explanation: str2 is appended at the end of str1

Example 2:

Input: str1 = "abc", str2 = "123"

Output: "abc123"

Now Your Turn!

Pick the correct output for the given input

Input: str1 = "Good", str2 = "Morning"

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 <= str1.length, str2.length <= 105
  • Strings may contain alphabets, digits, spaces, or special characters
0
class Solution {
public:
string concatenate(string str1, string str2) {
// Your code goes here
}
};
Test Case

Input:

Str1
Str2