题解 | 不要三句号的歪
不要三句号的歪
https://www.nowcoder.com/practice/7cbb7d96fb354f7995d9af1ccf8906b4
#include <iostream>
#include <sstream>
using namespace std;
int main() {
string input;
while (getline(cin, input)) { // 读取整行输入
long long a, b, c; // 使用 long long 类型存储数字
// 使用 stringstream 解析输入字符串
stringstream ss(input);
// 提取第一个数字 a
ss >> a;
// 跳过第一个逗号
ss.ignore();
// 提取第二个数字 b
ss >> b;
// 跳过省略号和第二个逗号
ss.ignore(5); // 跳过 ",..."
// 提取第三个数字 c
ss >> c;
// 计算省略的数字数量
long long omitted = c - b - 1;
cout << omitted << endl;
}
return 0;
}
