Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
100500 | 刘轻松 | 行程长度压缩 | C++ | Accepted | 1 MS | 288 KB | 404 | 2024-12-08 10:45:56 |
#include<bits/stdc++.h> using namespace std; int main(){ string s; int n=0; char c; cin>>s; for(int i=0;i<s.size();i++){ if(s[i]>='a' && s[i]<='z'){ s[i] = s[i]-32; } } n = 1; for(int i=1;i<s.size();i++){ if(s[i]==s[i-1]){ n++; } else{ printf("(%c,%d)",s[i-1],n); n=1; } if(i==s.size()-1){ printf("(%c,%d)",s[i],n); } } return 0; }