Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- void wtf() {
- FILE *f = fopen("log.txt", "w");
- char c;
- while((c = getchar()) != EOF) {
- fputc(c, f);
- }
- fclose(f);
- }
- int main() {
- wtf();
- FILE *f=fopen("log.txt", "r");
- char s[20];
- int count=0;
- while(fgets(s,20,f)!=NULL) {
- int i=0, j=strlen(s), br=0, flag=1;
- for(i=0; i<j; i++) {
- if(isdigit(s[i])){
- br++;
- }
- }
- if(br==strlen(s)-1){
- count++;
- }
- if(isalpha(s[0])&&isalpha(s[1])&&isalpha(s[2])&&isdigit(s[3])){
- count++;
- }
- if(isdigit(s[0])&&isdigit(s[1])&&isdigit(s[2]) && isdigit(s[3])&& isalpha(s[4]) && isalpha(s[5])){
- for(i=5;i<strlen(s);i++){
- if((isdigit(s[i]))){
- flag=0;
- }
- }
- if(flag){
- count++;
- }
- }
- }
- if(count==4) {
- printf("%d", count+1);
- }
- else
- if(count==9){
- printf("%d", count+1);
- }
- else
- printf("%d", count);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement