textMagician/textmagicscripts/snake-to-cammel/snake-to-cammel.c
2024-07-31 23:12:49 +02:00

44 lines
931 B
C

/*
* This simple program is created by Roland Hollós (hollorol@rolandhollos.net)
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_LINE_LEN 10000
int
main()
{
char s[MAX_LINE_LEN];
char out[MAX_LINE_LEN];
while(fgets(s, MAX_LINE_LEN, stdin) != NULL){
int string_length = strlen(s);
int k = 0;
int under = 0;
for(int i = 0; i < string_length; ++i)
{
/* if((s[i] >= 65) && (s[i] <= 90)) */
if((s[i] == '_') && !under){
under = 1;
continue;
}
if((s[i] <= 122) && (s[i] >= 90) && under)
{
out[k] = s[i] - 32;
k++;
under = 0;
continue;
}
out[k] = s[i];
k++;
under = 0;
}
out[k] = '\0';
printf("%s", out);
}
return 0;
}