fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5.  
  6.  
  7. bool table[34] = {0, }; // (0 ~ 25 : a ~ z), (26 ~ 33 : c= ~ z=)
  8. char str[102];
  9. int counter = 0;
  10.  
  11. cin >> str;
  12.  
  13. while( !((int) str[counter] == 0) ){
  14.  
  15. cout << counter <<" 번째 문자 보는중" << endl;
  16.  
  17. switch(str[counter]){
  18.  
  19. case 'c':
  20. if(str[counter + 1] == '='){
  21. table[26] = 1;
  22. counter++;
  23. }
  24. else if(str[counter + 1] == '-'){
  25. table[27] = 1;
  26. counter++;
  27. }
  28. else{
  29. table[2] = 1;
  30. }
  31. break;
  32.  
  33. case 'l':
  34. if(str[counter + 1] == 'j'){
  35. table[30] = 1;
  36. counter++;
  37. }
  38. else{
  39. table[11] = 1;
  40. }
  41. break;
  42.  
  43. case 'n':
  44. if(str[counter + 1] == 'j'){
  45. table[31] = 1;
  46. counter++;
  47. }
  48. else{
  49. table[13] = 1;
  50. }
  51. break;
  52.  
  53. case 's':
  54. if(str[counter + 1] == '='){
  55. table[32] = 1;
  56. counter++;
  57. }
  58. else{
  59. table[18] = 1;
  60. }
  61. break;
  62.  
  63. case 'd':
  64. if(str[counter + 1] == '-'){
  65. table[29] = 1;
  66. counter++;
  67. }
  68. else if( (str[counter + 1] == 'z') && (str[counter + 2] == '=') ){
  69. table[28] = 2;
  70. counter =+ 2;
  71. }
  72. else{
  73. table[3] = 1;
  74. }
  75. break;
  76.  
  77. case 'z':
  78. if(str[counter + 1] == '='){
  79. table[33] = 1;
  80. counter++;
  81. }
  82. else{
  83. table[25] = 1;
  84. }
  85. break;
  86.  
  87. default:
  88. table[(int)str[counter] - 97] = 1;
  89. break;
  90.  
  91. } // end of switch-case
  92.  
  93.  
  94. /*
  95. if(str[counter] == 'c'){
  96. if(str[counter + 1] == '='){
  97. table[26] = 1;
  98. counter++;
  99. }
  100. else if(str[counter + 1] == '-'){
  101. table[27] = 1;
  102. counter++;
  103. }
  104. else{
  105. table[2] = 1;
  106. }
  107. } // end of case 'c'
  108.  
  109. else if(str[counter] == 'l'){
  110. if(str[counter + 1] == 'j'){
  111. table[30] = 1;
  112. counter++;
  113. }
  114. else{
  115. table[11] = 1;
  116. }
  117. } // end of case 'l'
  118.  
  119. else if(str[counter] == 'n'){
  120. if(str[counter + 1] == 'j'){
  121. table[31] = 1;
  122. counter++;
  123. }
  124. else{
  125. table[13] = 1;
  126. }
  127. } // end of case 'n'
  128.  
  129. else if(str[counter] == 's'){
  130. if(str[counter + 1] == '='){
  131. table[32] = 1;
  132. counter++;
  133. }
  134. else{
  135. table[18] = 1;
  136. }
  137. } // end of case 's'
  138.  
  139. else if(str[counter] == 'd'){
  140. if(str[counter + 1] == '-'){
  141. table[29] = 1;
  142. counter++;
  143. }
  144. else if( (str[counter + 1] == 'z') && (str[counter + 2] == '=') ){
  145. table[28] = 2;
  146. counter =+ 2;
  147. }
  148. else{
  149. table[3] = 1;
  150. }
  151. } // end of case 'd'
  152.  
  153. else if(str[counter] == 'z'){
  154. if(str[counter + 1] == '='){
  155. table[33] = 1;
  156. counter++;
  157. }
  158. else{
  159. table[25] = 1;
  160. }
  161. } // end of case 'z'
  162.  
  163. else{
  164. table[(int)str[counter] - 97] = 1;
  165. } // end of normal alphab
  166.  
  167. */
  168.  
  169. counter++;
  170.  
  171. } // end of while
  172.  
  173. counter = 0;
  174. for(int c = 0; c < 34; c++){
  175. if(table[c]) counter++;
  176. }
  177.  
  178. /* DEBUG
  179. for(int t = 0; t < 34; t++){
  180.  
  181. cout << "(" << t << ", " << table[t] << ")" << endl;
  182.  
  183. }
  184. */
  185.  
  186. cout << counter << endl;
  187.  
  188. return 0;
  189. }
Success #stdin #stdout 0s 15240KB
stdin
ljes=njak
stdout
0 번째 문자 보는중
2 번째 문자 보는중
3 번째 문자 보는중
5 번째 문자 보는중
7 번째 문자 보는중
8 번째 문자 보는중
6