65,211
社区成员
发帖
与我相关
我的任务
分享#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
while(cin>>s)
{
string::size_type j=-1;
for(string::size_type i=0;i<s.size ();++i)
{
char c=s[i];
j=s.find(c);//我的j每次总是输出0,也许使用方法不当吧,请问该如何
//才能让j为s中等于s[i]的index呢?
if(j == -1)
break;
}
cout <<j;
}
return 0;
}