#include <stdio.h>
#include <string.h>
int main(void) {
char email[50]={"abc@xyz.se"};
int arroba = 0, ponto = 0, antesPonto = 0, depoisPonto = 0, i;
for (i = 0; i < tam; i++) {
char c = email[i];
if(c == '@') {
if (arroba)
break; // não pode ter uma segunda @
arroba = 1;
if (i < 3)
break; // se @ vier antes de 3 caracteres, erro
}
else if (arroba) { // se já encontrou @
if (ponto) { // se já encontrou . depois de @
depoisPonto++;
}
else if(c == '.') {
ponto = 1;
if (antesPonto < 3) {
break; // se . depois de @ vier antes de 3 caracteres, erro
}
}
else {
antesPonto++;
}
}
} // for
if (i == tam && depoisPonto > 1)
else
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KCmludCBtYWluKHZvaWQpIHsKCiAgY2hhciBlbWFpbFs1MF09eyJhYmNAeHl6LnNlIn07CiAgaW50IHRhbT1zdHJsZW4oZW1haWwpOwogIGludCBhcnJvYmEgPSAwLCBwb250byA9IDAsIGFudGVzUG9udG8gPSAwLCBkZXBvaXNQb250byA9IDAsIGk7CgogIGZvciAoaSA9IDA7IGkgPCB0YW07IGkrKykgewogICAgY2hhciBjID0gZW1haWxbaV07CiAgICBpZihjID09ICdAJykgewogICAgICBpZiAoYXJyb2JhKQogICAgICAgIGJyZWFrOyAvLyBuw6NvIHBvZGUgdGVyIHVtYSBzZWd1bmRhIEAKICAgICAgYXJyb2JhID0gMTsKICAgICAgaWYgKGkgPCAzKQogICAgICAgIGJyZWFrOyAvLyBzZSBAIHZpZXIgYW50ZXMgZGUgMyBjYXJhY3RlcmVzLCBlcnJvCiAgICB9CiAgICBlbHNlIGlmIChhcnJvYmEpIHsgLy8gc2UgasOhIGVuY29udHJvdSBACiAgICAgIGlmIChwb250bykgeyAvLyBzZSBqw6EgZW5jb250cm91IC4gZGVwb2lzIGRlIEAKICAgICAgICBkZXBvaXNQb250bysrOwogICAgICB9CiAgICAgIGVsc2UgaWYoYyA9PSAnLicpIHsKICAgICAgICBwb250byA9IDE7CiAgICAgICAgaWYgKGFudGVzUG9udG8gPCAzKSB7CiAgICAgICAgICBicmVhazsgLy8gc2UgLiBkZXBvaXMgZGUgQCB2aWVyIGFudGVzIGRlIDMgY2FyYWN0ZXJlcywgZXJybwogICAgICAgIH0KICAgICAgfQogICAgICBlbHNlIHsKICAgICAgICBhbnRlc1BvbnRvKys7CiAgICAgIH0KICAgIH0KICB9IC8vIGZvcgoKICBpZiAoaSA9PSB0YW0gJiYgZGVwb2lzUG9udG8gPiAxKQogICAgcHJpbnRmKCJWYWxpZG8iKTsKICBlbHNlCiAgICBwcmludGYoIkludmFsaWRvIik7Cn0K