1035 Password (20 分)【难度: 一般 / 知识点: 字符串 模拟】

在这里插入图片描述
https://pintia.cn/problem-sets/994805342720868352/problems/994805454989803520

#include<bits/stdc++.h>
using namespace std;
vector< pair<string,string> >ans;
int main(void)
{
    
    
    int t; cin>>t;
    for(int k=0;k<t;k++)
    {
    
    
        string a,b; cin>>a>>b;
        string temp=b;
        for(int i=0;i<b.size();i++)
        {
    
    
            if(b[i]=='1') b[i]='@';
            if(b[i]=='l') b[i]='L';
            if(b[i]=='0') b[i]='%';
            if(b[i]=='O') b[i]='o';
        }
        if(temp!=b)//不相等 说明有变化
        {
    
    
            ans.push_back({
    
    a,b});
        }
    }
    if(t==1) puts("There is 1 account and no account is modified");
    else if(!ans.size()) printf("There are %d accounts and no account is modified",t);
    else
    {
    
    
        cout<<ans.size()<<endl;
        for(int i=0;i<ans.size();i++) cout<<ans[i].first<<" "<<ans[i].second<<endl;
    }
}

猜你喜欢

转载自blog.csdn.net/qq_46527915/article/details/120398764