20求助!
查看原帖
20求助!
531709
LittleAcbg楼主2022/7/19 15:37
#include <bits/stdc++.h>
using namespace std;

string s,t;

bool same(string a, string b)
{
    if (a.length() != b.length()) return false;
    for (int i = 0; i < a.length(); i++)
        if (a[i] == b[i] || a[i] - 'a' + 'A' == b[i] || a[i] - 'A' + 'a' == b[i]) continue;
        else return false;
    return true;
}

int main()
{
    cin >> s;
    
    int cnt = 0,pos = -1,i = 0;
    while (cin >> t)
        if (same(s, t))
        {
            cnt++;
            if (pos == -1) pos = i;
        }
        else i++;
    
    if (cnt == 0) cout << -1 << endl;
    else cout << cnt << " " << pos << endl;
    
    return 0;
}

为什么这样?大佬帮帮忙!

2022/7/19 15:37
加载中...