Official

A - Move Right Editorial by en_translator


If you are new to learning programming and do not know where to start, please try Problem A “Welcome to AtCoder” from practice contest. There you can find a sample code for each language.
Also, if you are not familiar to problems in programming contests, we recommend you to try some problems in “AtCoder Beginners Selection” (https://atcoder.jp/contests/abs).
「競プロ典型 90 問」(Typical 90 Problems of Competitive Programming) (https://atcoder.jp/contests/typical90) is a collection of typical 90 competitive programming problems; unfortunately, currently the problem statements are all Japanese.
「C++入門 AtCoder Programming Guide for beginners (APG4b)」(https://atcoder.jp/contests/APG4b) is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.


Let \(S_i\) denote the \(i\)-th character of string \(S\).

Let \(T\) be the string that should be output in this problem, then \(T\) satisfies:

  • \(T_1=\) 0
  • \(T_2=S_1\)
  • \(T_3=S_2\)
  • \(T_4=S_3\)

so it is sufficient to construct such a string \(T\) and print it. In many programming languages, the \(i\)-th character of a string \(S\) can be obtained as S[i]. Note that however, the index (i in s[i]) starts with \(0\) in many languages.

Sample code (C++)

#include<bits/stdc++.h>
using namespace std;

int main(){
  string S;
  cin >> S;
  string T(4,0);
  T[0]='0';
  T[1]=S[0];
  T[2]=S[1];
  T[3]=S[2];
  cout << T;
}

posted:
last update: