Official

A - Last Letter Editorial by tatyam


プログラミングの学習を始めたばかりで何から手をつけるべきかわからない方は、まずは「practice contest」(https://atcoder.jp/contests/practice/) の問題A「Welcome to AtCoder」をお試しください。言語ごとに解答例が掲載されています。
また、プログラミングコンテストの問題に慣れていない方は、「AtCoder Beginners Selection」(https://atcoder.jp/contests/abs) の問題をいくつか試すことをおすすめします。
「競プロ典型 90 問」(https://atcoder.jp/contests/typical90) では、プログラミングコンテストで扱われる典型的な 90 問の問題に挑戦可能です。
「C++入門 AtCoder Programming Guide for beginners (APG4b)」(https://atcoder.jp/contests/APG4b) は、競技プログラマー向けのC++入門用コンテンツです。


問題文の通りに、文字列 \(S\) を受け取り、\(S\) の末尾の文字を出力すれば良いです。自分の使う言語での文字列の扱い方を確認しておきましょう。

実装例 (C++)

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

int main(){
    string S;
    cin >> S >> S;
    cout << S.back() << endl;
}

実装例 (Python)

input()
print(input()[-1])

posted:
last update: