在一行上输入一个长度不超过
的字符串。具体的规范为:仅包含三个无符号十进制整数
,形如
;数字
与
间使用一个半角逗号间隔;省略号部分由三个连续半角句号构成,且前后各有一个半角逗号。
在一行上输出一个整数代表被省略的数字数量。
2,3,...,7
3
1,2,...,100000000
99999997
a,b,c,d = (map(str,input().split(",")))
print(int(d)-int(a)-2) #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin>>s;
long long tail=s.find_last_of(',');
string stringtail=s.substr(tail+1);
long long numtail=stoll(stringtail,nullptr,10);
long long first=s.find(',');
long long i=first+1;
string stringfirst="";
while(isdigit(s[i]))
{
stringfirst+=s[i];
i++;
}
long long numfirst=stoll(stringfirst,nullptr,10);
cout<<numtail-numfirst-1;
}
#include <iostream>
#include<sstream>
#include<cctype>
using namespace std;
int main() {
string str;
while (cin >> str) {
for (auto& c : str) {
if (!isdigit(c)) {
c = ' ';
}
}
stringstream ss;
ss << str;
long long n, m, k;
ss >> n >> m >> k;
cout << k - m - 1 << endl;
}
} #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
string str;
while (cin >> str) { // 注意 while 处理多个 case
int len = str.length();
int pos = len - 1;
long long a = 0, b = 0, c = 0;
int cnt = 0;
vector<char> vc, vb, va;
while (pos >= 0) {
while (str[pos] != ',') {
vc.push_back(str[pos]);
pos--;
}
pos -= 5;
while (str[pos] != ',') {
vb.push_back(str[pos]);
pos--;
}
pos = -1;
}
reverse(vc.begin(), vc.end());
reverse(vb.begin(), vb.end());
for (auto iter = vc.begin(); iter != vc.end(); ++iter) {
c = c * 10 + *iter - '0';
}
for (auto iter = vb.begin(); iter != vb.end(); ++iter) {
b = b * 10 + *iter - '0';
}
cout << c - b - 1 << endl;
}
}
// 64 位输出请用 printf("%lld")