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