QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691952#5422. Perfect PalindromelselegiesWA 17ms3904kbC++14332b2024-10-31 13:31:102024-10-31 13:31:11

Judging History

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

  • [2024-10-31 13:31:11]
  • 评测
  • 测评结果:WA
  • 用时:17ms
  • 内存:3904kb
  • [2024-10-31 13:31:10]
  • 提交

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++)
		{
			int a=s[i]-'a';
			ans[a]++;
		}
		for (int i=0;i<26;i++)
			res=max(res,ans[i]);
		
		cout<<n-res<<endl;
	}
 } 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

input:

2
abcb
xxx

output:

2
0

result:

ok 2 number(s): "2 0"

Test #2:

score: -100
Wrong Answer
time: 17ms
memory: 3904kb

input:

11107
lfpbavjsm
pdtlkfwn
fmb
hptdswsoul
bhyjhp
pscfliuqn
nej
nxolzbd
z
clzb
zqomviosz
u
ek
vco
oymonrq
rjd
ktsqti
mdcvserv
x
birnpfu
gsgk
ftchwlm
bzqgar
ovj
nsgiegk
dbolme
nvr
rpsc
fprodu
eqtidwto
j
qty
o
jknssmabwl
qjfv
wrd
aa
ejsf
i
npmmhkef
dzvyon
p
zww
dp
ru
qmwm
sc
wnnjyoepxo
hc
opvfepiko
inuxx...

output:

8
6
0
7
2
4
-2
2
-4
-2
3
-5
-4
-3
0
-4
-1
1
-6
0
-4
-1
-2
-5
-2
-3
-6
-6
-4
-3
-10
-8
-11
-2
-8
-9
-10
-9
-12
-5
-7
-12
-10
-11
-11
-9
-12
-5
-13
-8
-10
-13
-12
-12
-16
-9
-12
-13
-9
-11
-13
-16
-19
-17
-16
-17
-18
-14
-19
-19
-10
-16
-16
-13
-10
-14
-19
-14
-18
-14
-15
-21
-13
-15
-19
-21
-15
-22
-...

result:

wrong answer 2nd numbers differ - expected: '7', found: '6'