1030. Print last character of string

Given a string s. Return the last character of the given string s.

Example 1:

Input : s = "takeuforward"

Output : d

Explanation : The last character of given string is "d".

Example 2:

Input : s = "goodforyou"

Output : u

Explanation : The last character of given string is "u".

Now Your Turn!

Pick the correct output for the given input

Input : s = "lovecoding"

Still unsure what the problem is asking ?

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

Constraints:

  • 1 <= s.length <= 100
  • s consist of only lowercase English letters
0
class Solution{
public:
char lastChar(string& s){
//your code goes here
}
};
Test Case

Input:

S