Stealth Fehler
The snippet can be accessed without any authentication.
Authored by
Erik Friesen
main.c 664 B
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int countIntInInteger(char* input){
char* out;
char* end = NULL;
int value = strtol(input, &end, 10);
out = malloc(value + strlen(input)); // could be shorter, but play it safe
if(value == 0)
{
return value;
}
for (int i = 0; i != value; i++)
{
char c = end[i];
if (c > 96 && c < 123) // ascii a-z
{
c -= 32;
}
out[i] = c;
}
free(out);
return value;
}
int main() {
char test[1024];
scanf("%[^\n]%*c", test);
countIntInInteger(test);
return 0;
}
Please register or sign in to comment