티스토리 뷰

반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
//PBL 2014244057 이종민
int main(){
    
    //글자 수 다르면 그냥 x
    //같으면 인덱스비교
    char str[100= {" "};
    char str2[100= {" "};
    
    int length = 0, length2 = 0;
    int i, j;
    
    scanf("%s", str);
    scanf("%s", str2);
    
    for(i = 0 ; i < 100; i++){
        
        if(str[i] != '\0')
            length++;
        
        if(str2[i] != '\0')
            length2++;
    }
 
    if(length == length2){
        
        for(j = 0; j < length; j++){
            
            if(str[j] == str2[j]){
                
                continue;
            }
            
            else if(str[j] != str2[j]){
                printf("다름\n");
                break;
            }
        }
        printf("같음\n");
    }
    
    else{
        
        printf("다름\n");
    }
    printf("%d %d", length, length2);
    
}
cs


댓글

티스토리 방명록

최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday