View Code of Problem 3857

#include<iostream>

using namespace std;

int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		int sum=0;
		for(int i=0;i<n;++i){
			string s;
			cin>>s;
			
			for(int i=0;i<s.length();++i){
				if(s[i]=='2'){
					sum++;
				}
			}
		}
		cout<<sum<<endl;
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 3857