Language: C++

// ???????????¢?????????
class DiceSurface
{
private:
	unsigned short	number_;	// ????????¢??????????????????

public:
	DiceSurface() {}
	DiceSurface(const unsigned short& number)
		: number_(number)
	{}

	~DiceSurface() {}

	// ?????????
	void setNumber(const unsigned short& number) { number_ = number; }
	// ?????????
	unsigned short getNumber() const { return number_; }

};


class Dice
{
private:
	const DiceSurface* top_;	// ?????¢
	const DiceSurface* north_;	// ?????¢
	const DiceSurface* south_;	// ?????¢
	const DiceSurface* east_; 	// ??±??¢
	const DiceSurface* west_; 	// ?\???¢
	const DiceSurface* bottom_;	// ?????¢

private:
	Dice() {}

public:
	Dice( const unsigned short& topNumber
		, const unsigned short& northNumber
		, const unsigned short& southNumber
		, const unsigned short& eastNumber
		, const unsigned short& westNumber
		, const unsigned short& bottomNumber )
	{
		top_	= new DiceSurface(topNumber);
		north_	= new DiceSurface(northNumber);
		south_	= new DiceSurface(southNumber);
		east_	= new DiceSurface(eastNumber);
		west_	= new DiceSurface(westNumber);
		bottom_	= new DiceSurface(bottomNumber);
	}

	~Dice() {
		delete top_;		
		delete north_;
		delete south_;
		delete east_; 
		delete west_; 
		delete bottom_;
	}

	unsigned short getTopNumber() {
		return top_->getNumber();
	}

	void rotateNorth() {
		const DiceSurface* tmp = top_;
		top_	= south_;
		south_	= bottom_;
		bottom_	= north_;
		north_	= tmp;
	}

	void rotateSouth() {
		const DiceSurface* tmp = top_;
		top_	= north_;
		north_	= bottom_;
		bottom_	= south_;
		south_	= tmp;
	}

	void rotateEast() {
		const DiceSurface* tmp = top_;
		top_	= west_;
		west_	= bottom_;
		bottom_	= east_;
		east_	= tmp;
	}

	void rotateWest() {
		const DiceSurface* tmp = top_;
		top_	= east_;
		east_	= bottom_;
		bottom_ = west_;
		west_	= tmp;
	}

	void rotateClockwise() {
		const DiceSurface* tmp = north_;
		north_	= west_;
		west_	= south_;
		south_	= east_;
		east_	= tmp;
	}

	void rotateAnticlockwise() {
		const DiceSurface* tmp = north_;
		north_	= east_;
		east_	= south_;
		south_	= west_;
		west_	= tmp;
	}
};

#include <vector>
#include <xstring>

using namespace std;

vector<string> split(const string &str, char delim){
	vector<string> res;
	size_t current = 0, found;
	while ((found = str.find_first_of(delim, current)) != string::npos){
		res.push_back(string(str, current, found - current));
		current = found + 1;
	}
	res.push_back(string(str, current, str.size() - current));
	return res;
}

#include <stdlib.h>
#include <iostream>

int main( int argc, char** argv )
{
	if ( argc < 3 ) {
		return 1;
	}

	vector<string> diceNumbers;
	{
		string inputedDiceNumbers(argv[1]);
		diceNumbers = split(inputedDiceNumbers, ' ');
	}

	if ( diceNumbers.size() < 6 ) {
		return 2;
	}

	Dice dice((unsigned short)atoi(diceNumbers[0].c_str())		// ?????¢
			, (unsigned short)atoi(diceNumbers[4].c_str())		// ?????¢
			, (unsigned short)atoi(diceNumbers[1].c_str())		// ?????¢
			, (unsigned short)atoi(diceNumbers[2].c_str())		// ??±??¢
			, (unsigned short)atoi(diceNumbers[3].c_str())		// ?\???¢
			, (unsigned short)atoi(diceNumbers[5].c_str()));	// ?????¢

	string inputedCommands(argv[2]);
	for ( const auto& it : inputedCommands ) {
		if ( it == 'N' ) {
			dice.rotateNorth();
		} else if ( it == 'S' ) {
			dice.rotateSouth();
		} else if ( it == 'E' ) {
			dice.rotateEast();
		} else if ( it == 'W' ) {
			dice.rotateWest();
		}
	}
	
	cout << dice.getTopNumber();

	return 0;
}

Compiler output:
a.cc:115:10: fatal error: xstring: No such file or directory
  115 | #include <xstring>
      |          ^~~~~~~~~
compilation terminated.