题解 | #字符串分隔#
字符串分隔
https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7
#include <iostream> #include<vector> using namespace std; int main() { vector<string> v; string s; int index = 0; while (cin >> s) { v.push_back(s); } for (auto s : v) { string temp; for (int i = 0; i < s.size(); i++) { temp += s[i]; index++; if (index == 8) { index = 0; cout << temp <<endl; temp.clear(); } } if (index != 0) { for (; index <= 7; index++) { temp += '0'; } cout << temp << endl; index = 0; } } } // 64 位输出请用 printf("%lld")