A.Love Story - 871A Div4 Solution in cpp | Codeforces

 Question 



Timur loves codeforces. That's why he has a string s having length 10 made containing only lowercase Latin letters. Timur wants to know how many indices string s differs from the string "codeforces".

For example string s="coolforsez" differs from "codeforces" in 4 indices, shown in bold. Help Timur by finding the number of indices where string s differs from "codeforces". Note that you can't reorder the characters in the string s.

Input

The first line contains a single integer t(1≤t≤1000) — the number of test cases.Each test case is one line and contains the string, consisting of exactly 10 lowercase Latin characters.


Output

For each test case, output a single integer — the number of indices where string s differs.

Example

input
Copy
5
coolforsez
cadafurcie
codeforces
paiuforces
forcescode
output
Copy
4
5
0
4
9

Explanation

Take a t test case and take input s string and make a string called str = "codeforces";

and traverse string s and str whenever they are not equal just cnt that part and increase it

at last just return that cnt as a answer.

Code

#include<bits/stdc++.h>

using namespace std;


#define test     long long T;cin>>T;while(T--)

#define all(x) (x).begin(), (x).end()


void solve(){

    string n; cin>>n;

    string m = "codeforces";


    int ans=0;

    for(int i=0;i<m.size();i++){

        if(n[i]!=m[i]) ans++;

    }

    cout<<ans<<endl;

}


signed main() {

    test

    //(if you want to take the more test cases you may uncomment it out)

    solve();

}







aav
Previous Post Next Post