Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
134933 林嘉乐 指针遍历字符串 C++ Accepted 2 MS 276 KB 247 2025-11-01 17:30:24

Tests(2/2):


Code:

#include<bits/stdc++.h> using namespace std; int main() { char a[31]={},*p,b; int n,sum=0; cin>>a; n=strlen(a); p=a; b=*(p+n-1); for(int i=0;i<n;i++){ if(*p==b){ sum++; } p++; } cout<<sum<<endl; return 0; }