Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Lapindromes codechef solution in c++

///////////////////////////////////////////////////////////////////
// problem link: https://www.codechef.com/LP1TO203/problems/LAPIN 
///////////////////////////////////////////////////////////////////
#include<iostream>
#include<cmath>
#define ll long long
#include<vector>
#include<stack>
#include<climits>
#include<algorithm>
using namespace std;

void solve()
{
	string s;
	cin >> s;
	ll n = s.length();
	string s1, s2;
	for (ll i = 0; i < n/2; i++)
	{
		s1 += s[i];
		s2 += s[n - 1 - i];
	}
	sort(s1.begin(), s1.end());
	sort(s2.begin(), s2.end());
	if (s1 == s2)
		cout << "YES
";
	else
		cout << "NO
";
}

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #Lapindromes #codechef #solution
ADD COMMENT
Topic
Name
7+4 =