QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#692004#5422. Perfect PalindromelselegiesWA 0ms3828kbC++14371b2024-10-31 13:37:142024-10-31 13:37:14

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 13:37:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3828kb
  • [2024-10-31 13:37:14]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int ans[26];
signed main()
{
	int t;
	cin>>t;
	while(t--)
	{
		string s;
		cin>>s;
		s=" "+s;
		int n=s.size()-1,res=0;
		for (int i=1;i<=n;i++)
		ans[i]=0;
		for (int i=1;i<=n;i++)
		{
			int a=s[i]-'a';
			ans[a]++;
		}
		for (int i=1;i<=n;i++)
			res=max(res,ans[i]);
		
		cout<<n-res<<endl;
	}
 } 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3828kb

input:

2
abcb
xxx

output:

2
3

result:

wrong answer 2nd numbers differ - expected: '0', found: '3'