You are viewing a single comment's thread. Return to all comments →
My C code 😎😁
void separateNumbers(char* s) { int len = strlen(s); if(len == 1){ printf("NO\n"); return; } for(int i = 1;i <= len /2 ;i++){ char t[32]; strncpy(t,s,i); t[i] = '\0'; long long firstNum = atoll(t); char tempStr[1024]; snprintf(tempStr,sizeof(tempStr),"%lld",firstNum); long long nextNum = firstNum + 1; while(strlen(tempStr) < len){ char buffer[32]; snprintf(buffer,sizeof(buffer),"%lld",nextNum); strcat(tempStr,buffer); nextNum++; } if(strcmp(tempStr,s) == 0){ printf("YES %lld\n",firstNum); return; } } printf("NO\n"); }
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
My C code 😎😁