#include <stdio.h>
void expand(char s1[], char s2[]);
int getline(char s[], int lim);
int main(void) {
char s1[1000];
char s2[1000];
getline(s1, 1000);
expand(s1, s2);
return 0;
}
void expand(char s1[], char s2[])
{
int j = 1; //index for s2
int c; // for saving starting point
s2[0] = s1[0]; //for preventing errors from 'i-1'
for(int i
=1; i
<= strlen(s1
); i
++) {
if(s1[i] == '-')
{
{
c = s1[i-1] + 1;
while(c < s1[i+1])
{
s2[j++] = c++;
}
}
}
else
{
s2[j++] = s1[i];
}
}
}
int getline(char s[], int lim) //getline and return length except '\0'
{
int c, i;
for(i
=0; i
<= lim
-1 && (c
=getchar()) != EOF
&& c
!= '\n'; i
++) {
s[i] = c;
}
if(c=='\n')
{
s[i] = c;
i++;
}
s[i] = '\0';
return i;
}