公式

A - Spread 解説 by en_translator


For beginners
  • 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 with problems in programming contests, we recommend you to try some problems in "AtCoder Beginners Selection".


Follow the instructions of the problem statement to print each character of \(S\) and a space alternatingly.

Sample code

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

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size() - 1; i++) cout << s[i] << ' ';
	cout << s.back() << endl;
}

投稿日時:
最終更新: