Solução: Problema da palavra mágica (Marco Antonio)

From AdonaiMedrado.Pro.Br
Jump to: navigation, search
#include <algorithm>
#include <iostream>
#include <string>
 
using namespace std;
 
int main()
{
	string entry, word;
 
	cin >> entry;
	if (entry.length() % 2 == 0)
	{
		word = entry.substr(0, (entry.length()/2));
		entry = entry.substr(entry.length()/2, entry.length());
		sort(word.begin(),word.end());
		if (!(entry.compare(word)))
		{
			cout << "S" << endl;
			return 1;
		}
	}
	cout << 'N' << endl;
	return 0;
}