#268. firstTwo
firstTwo
Background
Description
Given a string, return the string made of its first two chars, so the String "Hello" yields "He". If the string is shorter than length 2, return whatever there is, so "X" yields "X", and the empty string "" yields the empty string "". Note that str.length() returns the length of a string.
Format
Input
Output
Samples
Hello
"He"
abcdefg
"ab"
ab
"ab"
Limitation
1s, 1024KiB for each test case.