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. if(str[counter] == 'c'){
  18. if(str[counter + 1] == '='){
  19. table[26] = 1;
  20. counter++;
  21. }
  22. else if(str[counter + 1] == '-'){
  23. table[27] = 1;
  24. counter++;
  25. }
  26. else{
  27. table[2] = 1;
  28. }
  29. } // end of case 'c'
  30.  
  31. else if(str[counter] == 'l'){
  32. if(str[counter + 1] == 'j'){
  33. table[30] = 1;
  34. counter++;
  35. }
  36. else{
  37. table[11] = 1;
  38. }
  39. } // end of case 'l'
  40.  
  41. else if(str[counter] == 'n'){
  42. if(str[counter + 1] == 'j'){
  43. table[31] = 1;
  44. counter++;
  45. }
  46. else{
  47. table[13] = 1;
  48. }
  49. } // end of case 'n'
  50.  
  51. else if(str[counter] == 's'){
  52. if(str[counter + 1] == '='){
  53. table[32] = 1;
  54. counter++;
  55. }
  56. else{
  57. table[18] = 1;
  58. }
  59. } // end of case 's'
  60.  
  61. else if(str[counter] == 'd'){
  62. if(str[counter + 1] == '-'){
  63. table[29] = 1;
  64. counter++;
  65. }
  66. else if( (str[counter + 1] == 'z') && (str[counter + 2] == '=') ){
  67. table[28] = 2;
  68. counter =+ 2;
  69. }
  70. else{
  71. table[3] = 1;
  72. }
  73. } // end of case 'd'
  74.  
  75. else if(str[counter] == 'z'){
  76. if(str[counter + 1] == '='){
  77. table[33] = 1;
  78. counter++;
  79. }
  80. else{
  81. table[25] = 1;
  82. }
  83. } // end of case 'z'
  84.  
  85. else{
  86. table[(int)str[counter] - 97] = 1;
  87. } // end of normal alphab
  88.  
  89. counter++;
  90.  
  91. } // end of while
  92.  
  93. counter = 0;
  94. for(int c = 0; c < 34; c++){
  95. if(table[c]) counter++;
  96. }
  97.  
  98. /* DEBUG
  99. for(int t = 0; t < 34; t++){
  100.  
  101. cout << "(" << t << ", " << table[t] << ")" << endl;
  102.  
  103. }
  104. */
  105.  
  106. cout << counter << endl;
  107.  
  108. return 0;
  109. }
Success #stdin #stdout 0s 16064KB
stdin
ljes=njak
stdout
0 번째 문자 보는중
2 번째 문자 보는중
3 번째 문자 보는중
5 번째 문자 보는중
7 번째 문자 보는중
8 번째 문자 보는중
6