Submission #1177910


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
int main(){
	string x;
	cin >> x;
	int n;
	cin >> n;
	int t1,t2;
	string tS;
	for(int i=0; i<n; i++){
		cin >> t1 >> t2;
		tS = x[t1-1];
		x[t1-1] = x[t2-1];
		x[t2-1] = tS;
	}
	cout << x << endl;
	return 0;
}

Submission Info

Submission Time
Task B - 文字列の反転
User saidat
Language C++14 (GCC 5.4.1)
Score 0
Code Size 272 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:11: error: cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘char’ in assignment
   x[t2-1] = tS;
           ^