题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
#include <stdio.h> #include <string.h> int main() { char str[100]; while (scanf("%s", str) != EOF) { int n = strlen(str); for(int i = 0; i < n; i++) { printf("%c", str[i]); if((i + 1) % 8 == 0) printf("\n"); } int m = n % 8; if(m) { for(int i = 0; i < 8 - m; i++) { printf("%c", '0'); } printf("\n"); } } return 0; }