---
# System prepended metadata

title: 13891 - Polymorphic naming convention conversion
tags: [class]

---

# 13891 - Polymorphic naming convention conversion
###### tags: `class`
---

## Brief
See the code below

## Solution 0

```cpp=
#include <iostream>
#include <string>
#include <sstream>
#include "function.h"
using namespace std;

void CamelCase::convert() {
    converted = true;
    stringstream ss;
    string tmp;
    ss << name;
    while (!ss.eof()) {
        string token;
        getline(ss, token, '-');
        token[0] -= 32;
        tmp += token;
    }
    name = tmp;
}

void CamelCase::revert() {
    converted = false;
    string tmp;
    for (int i = 0; i < name.length(); i++) {
        if (name[i] < 'a') {
            if (i) tmp += '-';
            name[i] += 32;
        }
        tmp += name[i];
    }
    name = tmp;
}

// Utin
```

## Reference