This problem is based on "13891 - Polymorphic naming convention conversion".
In this problem, we consider an Integrated Development Environment (IDE) that supports naming convention conversion. We assume that the snake case is the default naming convention:
The IDE can convert to a different naming convention according to a programmer’s preference. The IDE can also revert back to the default naming convention for the integration among multiple program files.
Branny, an I2P student, after learning the idea of naming conventions, has also created her own two new naming conventions:
In this problem, we have the abstract base class ‘Case’ as an interface, which contains two pure virtual member functions:
#include <string>
using namespace std;
class Case{
protected:
bool converted;
string name;
public:
virtual void convert() = 0;
virtual void revert() = 0;
virtual ~Case(){}
Case(string s): converted(false), name(s){}
void show(ostream &os){
os << name;
}
bool is_converted() const{
return converted;
}
};
class CastleCase: public Case{
public:
CastleCase(string s): Case(s){}
void convert();
void revert();
};
class NumberCase: public Case{
public:
NumberCase(string s): Case(s){}
void convert();
void revert();
};
You are asked to implement the two derived classes ‘CastleCase’ and ‘NumberCase’ by overriding the two pairs of virtual functions, convert and revert, to support the conversion for Branny's preferred naming conventions. :)
The first line contains a string, which can be ‘castle’, ‘number’ or ‘both’.
The second line contains only lowercase letters and underscores, representing the variable name with the snake case.
Constraints:
Testcases 1~3: The first line would be ‘castle’.
Testcases 4~6: The first line would be ‘number’.
Testcases 7~10: The first line would be ‘both’.
The Castle case and the Number case for the input string.
If the first line of input is ‘castle’, print only the castle case.
If the first line of input is ‘number’, print only the number case.
Otherwise, print both of them.
Please refer to the sample output for details.