3.1.3 饭店服务员张三
勤奋踏实关注
2.1.1 导航天天提高
多少大学高度吹吹风
是什么意思
3.1.2 需要将标号下的多行字一起按编号排序
能自动排序
自动排版后成为:
2.1.1导航天天提高
多少大学高度吹吹风
是什么意思
3.1.2 需要将标号下的多行字一起按编号排序
能自动排序
3.1.3 饭店服务员张三
勤奋踏实关注
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <tuple>
int main() {
std::string line;
std::map<std::tuple<int, int, int>, std::string> map;
std::tuple<int, int, int> key;
while (std::getline(std::cin, line)) {
int a, b, c;
char d1, d2;
std::istringstream ss(line);
if ((ss >> std::noskipws >> a >> d1 >> b >> d2 >> c) && (d1 == '.') &&
(d2 == '.')) {
key = std::make_tuple(a, b, c);
map[key] = line + '\n';
} else {
map[key] += line + '\n';
}
}
for (auto itr = map.begin(); itr != map.end(); itr++)
std::cout << itr->second;
return 0;
}