以下是用C++实现的代码:

#include <iostream>
#include <string>
using namespace std;

int main() {
    string s;
    int n;
    cin >> s >> n;

    string reversed = s;
    reverse(reversed.begin(), reversed.end());

    cout << reversed[n-1] << endl;

    return 0;
}

运行示例:

输入:

HONGHE
15

输出:

N

输入:

MZYZ
31

输出:

Z

标签: 教育


原文地址: https://www.cveoy.top/t/topic/hF6T 著作权归作者所有。请勿转载和采集!