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 | #include<cstdio> #include<iostream> #include<cstring> #include<string> using namespace std; int main(void) { int n; char sstr[35],cmp[2]; scanf("%d", &n); for(int i=0; i<n; i++) { sstr[0]='\0'; scanf("%s", sstr); int len=strlen(sstr); cmp[0]=sstr[len-2]; cmp[1]=sstr[len-1]; switch(cmp[1]) { case 'a': strcat(sstr,"s"); break; case 'i': strcat(sstr,"os"); break; case 'y': sstr[len-1]=NULL; strcat(sstr,"ios"); break; case 'l': strcat(sstr,"es"); break; case 'n': sstr[len-1]=NULL; strcat(sstr,"anes"); break; case 'e': if(cmp[0]=='n') { sstr[len-2]=NULL; strcat(sstr,"anes"); break; } strcat(sstr , "us"); break; case 'o': strcat(sstr,"s"); break; case 'r': strcat(sstr, "es"); break; case 't': strcat(sstr, "as"); break; case 'u': strcat(sstr, "s"); break; case 'v': strcat(sstr, "es"); break; case 'w': strcat(sstr, "as"); break; default: strcat(sstr, "us"); } printf("%s\n", sstr); } return 0; } | cs |
당연히 if문으로 해도 된다.
'백준 1 > 기타' 카테고리의 다른 글
| [백준 1920] 수 찾기 (C++) (0) | 2020.12.06 |
|---|---|
| [백준 11651] 좌표 정렬하기 - 2 (C++) (0) | 2020.12.06 |
| [백준 11650] 좌표 정렬하기 (C++) (0) | 2020.12.06 |
| [백준 10988] 팰린드롬인지 확인하기 (C++/Python) (0) | 2020.12.06 |
| [백준 15874] Caesar Cipher (C++/Python) (0) | 2020.12.06 |