#13536: 請問這樣為甚麼錯 WA (line:3)


s940063t (lihchyi)


#include<iostream>
#include<string>
using namespace std;
int main()
{
string str,str1;
while (cin >> str)
{
for (int i = str.length() - 1; i >= 0; i--)
{
str1 += str[i];
}
if (str1 == str)
{
cout << "yes" << endl;
}
else
{
cout << "no" << endl;
}
}
return 0;
}

#13537: Re:請問這樣為甚麼錯 WA (line:3)


justinO__o (夜貓)


#include
#include
using namespace std;
int main()
{
string str,str1;
while (cin >> str)
{
for (int i = str.length() - 1; i >= 0; i--)
{
str1 += str[i];
}
if (str1 == str)
{
cout << "yes" << endl;
}
else
{
cout << "no" << endl;
}
}
return 0;
}


string str, str1;

while (cin >> str) {

  str1 = "";

  for ...

}