1035. Password (20)

1.简单的字符串处理

2.注意0,1个没有修改是,是is,大于1个是,是are

//#include<string>
//#include <iomanip>
#include<vector>
#include <algorithm>
//#include<stack>
#include<set>
#include<queue>
#include<map>
//#include<unordered_set>
#include<unordered_map>
//#include <sstream>
//#include "func.h"
//#include <list>
#include<stdio.h>
#include<iostream>
#include<string>
#include<memory.h>
#include<limits.h>
using namespace std;

char replace(char a)
{
	switch (a)
	{
	case'1':return '@';
	case'0':return '%';
	case'l':return 'L';
	case'O':return 'o';
	default:return a;
	}
}

int main(void)
{
	int n;
	cin >> n;
	vector<pair<string, string>> ans(0);
	for (int i = 0; i < n; i++)
	{
		string name, pw;
		cin >> name >> pw;
		bool re = false;
		for (int i = 0; i < pw.size(); i++)
		{
			if (pw[i] == '1' || pw[i] == '0' || pw[i] == 'l' || pw[i] == 'O')
			{
				pw[i] = replace(pw[i]);
				re = true;
			}
		}
		if (re)
		{
			ans.push_back({ name, pw });
		}
	}
	if (ans.size() == 0)
	{
		if (n<=1)
			printf("There is %d account and no account is modified\n", n);
		else
			printf("There are %d accounts and no account is modified\n", n);

	}
	else
	{
		cout << ans.size() << endl;
		for (int i = 0; i < ans.size(); i++)
			cout << ans[i].first << " " << ans[i].second << endl;
	}
	return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值