Automated grading of homework assignments and tests
- fork this repository
- solve the task
- commit with proper message
The s string variable is given. return the four characters from the beginning.
Example 1:
Input: a="codeschooluz"
Output: "code"
Example 2:
Input: a="code"
Output: "code"
Constraints:
- 4 <= length(a) <= 10^5
The s string variable is given. return four characters from the end.
Example 1:
Input: a="codeschooluz"
Output: "oluz"
Example 2:
Input: a="python"
Output: "thon"
Constraints:
- 4 <= length(a) <= 10^5
The s string variable is given. Return all characters except the one at the beginning and end.
Example 1:
Input: a="hello"
Output: "ell"
Example 2:
Input: a="positive"
Output: "ositiv"
Constraints:
- 2 <= length(a) <= 10^5
The s string variable is given. Return all characters except the one at the beginning and end.
Example 1:
Input: a="hello"
Output: "ell"
Example 2:
Input: a="positive"
Output: "ositiv"
Constraints:
- 2 <= length(a) <= 10^5
The s string variable is given. return n characters from the beginning.
Example 1:
Input: a="negative", n=2
Output: "ne"
Example 2:
Input: a="positive" n=2
Output: "po"
Constraints:
- 2 <= length(a) <= 10^5
- 1 <= n <= length(a)
The s string variable is given. return n characters from the end.
Example 1:
Input: a="codeschooluz", n=3
Output: "luz"
Example 2:
Input: a="positive" n=1
Output: "e"
Constraints:
- 2 <= length(a) <= 10^5
- 1 <= n <= length(a)
The s string variable is given. return all characters except n characters from the beginning.
Example 1:
Input: a="codeschooluz", n=3
Output: "eschooluz"
Example 2:
Input: a="apple" n=1
Output: "pple"
Constraints:
- 2 <= length(a) <= 10^5
- 1 <= n <= length(a)
The s string variable is given. return all characters except n characters at the end.
Example 1:
Input: a="codeschooluz", n=3
Output: "codeschoo"
Example 2:
Input: a="apple" n=1
Output: "appl"
Constraints:
- 2 <= length(a) <= 10^5
- 1 <= n <= length(a)
The s string variable is given. return the characters in the odd position.
Example 1:
Input: a="codeschooluz"
Output: "oecolz"
Example 2:
Input: a="apple"
Output: "pl"
Constraints:
- 2 <= length(a) <= 10^5
- 1 <= n <= length(a)
The s string variable is given. return the characters in the even position.
Example 1:
Input: a="codeschooluz"
Output: "cdshou"
Example 2:
Input: a="apple"
Output: "ape"
Constraints:
- 2 <= length(a) <= 10^5
- 1 <= n <= length(a)
The s string variable is given. return from index n to index k.
Example 1:
Input: a="codeschooluz" n=2 k=5
Output: "des"
Example 2:
Input: a="apple" n=2 k=2
Output: "p"
Constraints:
- 2 <= length(a) <= 10^5
- 0 <= n <= length(a)
- n <= k <= length(a)
- don't copy other solutions or any solution
- don't remove comments