c++ get last n characters of string code example
Example 1: find last occurrence of character in string c++
auto find_char = 'a'
size_t last_occurence_index = str.find_last_of(find_char);
Example 2: get first and last character of string c++
auto first_char = str.front()
auto last_char = str.back()