Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
117766 | 任斌 | 指针遍历字符串 | C++ | Accepted | 1 MS | 276 KB | 210 | 2025-04-20 11:59:12 |
#include<bits/stdc++.h> using namespace std; int main() { char a[31],*p; int c=0,l,z; cin>>a; p=a; l=strlen(a); z=*(p+l-1); for(int i=0;i<l;i++){ if(z==*p)c++; p++; } cout<<c; return 0; }