Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <stdio.h>
- struct lista{
- char numero[205];
- };
- int main(){
- int n;
- while(scanf("%d", &n) != EOF ){
- struct lista telefonica[n];
- int i;
- for(i = 0; i < n; i++){
- scanf("%s", telefonica[i].numero);
- }
- int subtotal, total = 0, j, tam = strlen(telefonica[0].numero);
- for(i = 1; i < n; i++){
- subtotal = 0;
- for(j = 0; j < tam; j++){
- if(telefonica[i].numero[j] == telefonica[i - 1].numero[j]){
- subtotal = subtotal + 1;
- }
- }
- if(subtotal > total){
- total = subtotal;
- }
- }
- printf("%d\n", total);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment