#include <string>
#include <iostream>
#include <cstdio>
#include <cctype>
using namespace std;
void solve(const string &s, bool flag)
{
int objL, objR, subL, subR, verL, verR;
objL = s.find('{'), objR = s.find('}');
subL = s.find('('), subR = s.find(')');
verL = s.find('['), verR = s.find(']');
string obj(s.substr(objL+1, objR-objL-1));
string sub(s.substr(subL+1, subR-subL-1));
string ver(s.substr(verL+1, verR-verL-1));
if (!flag) {
obj[0] = toupper(obj[0]);
} else {
obj[0] = tolower(obj[0]);
}
sub[0] = tolower(sub[0]);
ver[0] = tolower(ver[0]);
cout << obj << " " << sub << " " << ver;
}
inline bool isPar(char c)
{
return (c == '[' || c == '(' || c == '{');
}
int main()
{
//freopen("in.txt", "r", stdin);
string s;
while (getline(cin, s)) {
size_t comPos = s.find(',');
if (comPos == string::npos) {
solve(s, 0);
} else {
size_t tmp = comPos;
while (!isPar(s[tmp])) {
++tmp;
}
solve(s.substr(0, comPos), 0);
cout << s.substr(comPos, tmp-comPos);
solve(s.substr(tmp, s.size()-tmp+1), 1);
cout << '\n';
}
}
return 0;
}
timus 1993. This cheeseburger you don't need
最新推荐文章于 2022-01-31 00:03:12 发布