URLify (Replace Spaces)

Replace all spaces in a string with `%20`. (Cracking the Coding Interview: typically assume enough buffer at end of string).

Input Format

One line string s (may contain spaces).

Output Format

Output string with spaces replaced by "%20".

Constraints

  • Length up to 1000.

Examples

Example 1:

Input:

s = "Mr John Smith"

Output:

Mr%20John%20Smith

Explanation:

All spaces replaced by "%20".

Loading...
URLify (Replace Spaces) - Strings DSA Problem