fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int long long int
  4. signed main() {
  5. // your code goes here
  6. string pi = "314159265358979323846264338327";
  7. int t;
  8. cin>>t;
  9. while(t--)
  10. {
  11. string s;
  12. cin>>s;
  13. int cnt = 0;
  14. for(int i=0;i<s.length();i++)
  15. {
  16. if(pi[i] == s[i])
  17. {
  18. cnt++;
  19. }
  20. }
  21. cout<<cnt<<endl;
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5528KB
stdin
9
000
3
4141592653
141592653589793238462643383279
31420
31415
314159265358
27182
314159265358979323846264338327
stdout
0
1
9
1
3
5
12
0
30