Tuesday, January 28, 2014

codechef LUCKY5 - "lucky long" solution

codechef LUCKY5 - "lucky long" : http://www.codechef.com/problems/LUCKY5

codechef LUCKY5 - "lucky long" solution :  http://ideone.com/O9tKEU

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
int t, cnt;
char s[1000000];
scanf("%d", &t);
while(t--) {
scanf("%s", s);
cnt=0;
for(int i=0; i<strlen(s); i++) if(s[i]!='4' && s[i]!='7') cnt++;
printf("%d\n", cnt);
}
return 0;
}

No comments:

Post a Comment