https://www.codechef.com/problems/PALL01
In C++....................
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
string s;
cin>>t;
while(t--)
{
cin>>s;
string ss=s;
reverse(s.begin(),s.end());
if(ss==s)
{
cout<<"wins"<<endl;
}
else
{
cout<<"losses"<<endl;
}
}
return 0;
}
In C++....................
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
string s;
cin>>t;
while(t--)
{
cin>>s;
string ss=s;
reverse(s.begin(),s.end());
if(ss==s)
{
cout<<"wins"<<endl;
}
else
{
cout<<"losses"<<endl;
}
}
return 0;
}
No comments:
Post a Comment