Task: | Järjestys |
Sender: | Anttono |
Submission time: | 2022-01-22 13:06:09 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:17:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j=0;j<s.size();j++) ~^~~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; int t; int main() { cin>>t; string s; for(int i=0;i<t;i++) { cin>>s; string so = s; sort(s.begin(), s.end()); int r = 0; for(int j=0;j<s.size();j++) { if(s[j] != so[j]) r++; } cout<<r/2<<'\n'; } }