Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3633 邓程允 统计特定单词数 C++ Compile Error 0 MS 0 KB 617 2024-06-22 09:54:16

Tests(0/0):


Code:

# include<iostream> # include<cstring> using namespace std; string s1,s2; int cnt=0,f=-1; string a(string s){ for(int i=0;i<s.size();i++){ if(s[i]>='A'&&s[i]<='Z') s[i]=s[i]+32; } return s; } void b(string s1,string s2){ s1=' '+s1+' '; s2=' '+s2+' '; int p=s2.find(s1); f=p; while(p!=-1){ cnt++; p=s2.find(s1,p+1); } } int main(){ getline(cin,s1); getline(cin,s2); s1=a(s1); s2=a(s2); b(s1,s2); if(cnt==0){ cout<<-1<<endl; } else cout<<cnt<<" "<<pos<<endl; return 0; }


Run Info:

Main.cc: In function 'std::string a(std::string)':
Main.cc:7:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++){
                          ^
Main.cc: In function 'int main()':
Main.cc:32:26: error: 'pos' was not declared in this scope
     else cout<<cnt<<" "<<pos<<endl;
                          ^