diff --git a/code_study/Baekjoon/c/10809.c b/code_study/Baekjoon/c/10809.c new file mode 100644 index 0000000..72ccb1b --- /dev/null +++ b/code_study/Baekjoon/c/10809.c @@ -0,0 +1,18 @@ +#include +int main(){ + int arr[26] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; + int temp=0; + char s[101]; + scanf("%s",s); + for(int i=0; s[i]!='\0'; i++){ + temp = (int)(s[i]-'a'); + if(arr[temp]==-1) arr[temp]=i; + } + + for(int i=0; i<26; i++){ + printf("%d ",arr[i]); + } + + return 0; + +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/1152.c b/code_study/Baekjoon/c/1152.c new file mode 100644 index 0000000..ea25c11 --- /dev/null +++ b/code_study/Baekjoon/c/1152.c @@ -0,0 +1,19 @@ +#include + +int main(){ + char s[1000001]; + scanf("%[^\n]",s); + + int n=0; + + if(s[0]!=' ') n=1; + + for(int i=0; s[i+1]!='\0'; i++){ + if((s[i]==' ') && (s[i+1]!=' ')) n++; + } + + printf("%d",n); + + return 0; + +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/11654.c b/code_study/Baekjoon/c/11654.c new file mode 100644 index 0000000..db8fa4a --- /dev/null +++ b/code_study/Baekjoon/c/11654.c @@ -0,0 +1,7 @@ +#include +int main(){ + char c; + c = getchar(); + printf("%d",c); + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/11718.c b/code_study/Baekjoon/c/11718.c new file mode 100644 index 0000000..a92b979 --- /dev/null +++ b/code_study/Baekjoon/c/11718.c @@ -0,0 +1,9 @@ +#include + +int main(){ + char s; + while(scanf("%c",&s)!= EOF){ + printf("%c",s); + } + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/11720.c b/code_study/Baekjoon/c/11720.c new file mode 100644 index 0000000..ceac60b --- /dev/null +++ b/code_study/Baekjoon/c/11720.c @@ -0,0 +1,12 @@ +#include +int main(){ + int n, sum=0; + char s[101]; + scanf("%d",&n); + scanf("%s",s); + for(int i=0; i + +int main(){ + int t,n; + char s[20]; + + scanf("%d",&t); + + for(int i=0; i +int main(){ + char s[101]; + int l=0; + gets(s); + for(l=0; s[l]!='\0'; l++); + printf("%d",l); + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/27866.c b/code_study/Baekjoon/c/27866.c new file mode 100644 index 0000000..d511304 --- /dev/null +++ b/code_study/Baekjoon/c/27866.c @@ -0,0 +1,9 @@ +#include +int main(){ + char s[1001]; + int i; + scanf("%s",s); + scanf("%d",&i); + printf("%c",s[i-1]); + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/2908.c b/code_study/Baekjoon/c/2908.c new file mode 100644 index 0000000..6748d45 --- /dev/null +++ b/code_study/Baekjoon/c/2908.c @@ -0,0 +1,25 @@ +#include +#include +/*atoi*/ +int main(){ + char a[4], b[4]; + char temp; + int x,y; + + scanf("%s %s",a,b); + + temp = a[0]; + a[0] = a[2]; + a[2] = temp; + + temp = b[0]; + b[0] = b[2]; + b[2] = temp; + + x = atoi(a); + y = atoi(b); + + printf("%d",x>y ? x : y); + + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/5622.c b/code_study/Baekjoon/c/5622.c new file mode 100644 index 0000000..827a063 --- /dev/null +++ b/code_study/Baekjoon/c/5622.c @@ -0,0 +1,18 @@ +#include + +int main(){ + int dial[26] = {3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,8,9,9,9,10,10,10,10}; + char s[16]; + int t=0; + + scanf("%s",s); + + for(int i=0; s[i]!='\0'; i++){ + t+=dial[(int)(s[i]-'A')]; + } + + printf("%d",t); + + return 0; + +} \ No newline at end of file diff --git a/code_study/Baekjoon/c/9086.c b/code_study/Baekjoon/c/9086.c new file mode 100644 index 0000000..573e8e7 --- /dev/null +++ b/code_study/Baekjoon/c/9086.c @@ -0,0 +1,12 @@ +#include +#include +int main(){ + int n; + char s[1001]; + scanf("%d",&n); + while(n--){ + scanf("%s",s); + printf("%c%c\n",s[0], s[strlen(s)-1]); + } + return 0; +} \ No newline at end of file