【[Offer收割]编程练习赛13 A】风格不统一如何写程序
【题目链接】:http://hihocoder.com/problemset/problem/1501
【题意】
【题解】
模拟题
【Number Of WA】
1
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define ps push_back
#define fi first
#define se second
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%lld",&x)
#define ref(x) scanf("%lf",&x)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110;
int n;
char s[200];
int main()
{
//freopen("F:\\rush.txt","r",stdin);
rei(n);
rep1(i,1,n)
{
scanf("%s",s+1);
int len = strlen(s+1);
rep1(j,1,len)
if (s[j]=='_')
{
if (j+1<=len)
s[j+1]=s[j+1]-'a'+'A';
continue;
}
else
if (s[j-1]!='_' && s[j]>='A'&&s[j]<='Z')
{
putchar('_');
putchar(s[j]-'A'+'a');
}
else
putchar(s[j]);
puts("");
}
//printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);
return 0;
}