注意:用字符串表示时,字符串s的最后一个元素用数组下标表示应该为:s[s.size() - 1];
#include <iostream>
#include <string>
using namespace std;
char r[110];
int main ()
{
string a;
getline(cin, a);
for (int i = 0, len = a.size(); i < len; i ++ )
{
r[i] = a[i] + a[i + 1];
}
r[a.size() - 1] = a[a.size() - 1] + a[0];
for (int i = 0, len = a.size(); i < len; i ++) cout << r[i];
cout << endl;
return 0;
}