fork(5) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4.  
  5. using namespace std;
  6. string wyraz;
  7. int dlugosc;
  8.  
  9.  
  10. int main()
  11. {
  12.  
  13.  
  14.  
  15. while(getline(cin,wyraz))
  16. {
  17. char t1;
  18. //dla pierwszego elementu
  19. if(wyraz[0]==' ')
  20. {
  21. wyraz.erase(0,1);
  22. if(isalpha(wyraz[0]))
  23. {
  24. if( islower( wyraz[0] ) )
  25. {
  26. t1 = toupper(wyraz[0]);
  27. cout<<t1;
  28. }
  29. }
  30. }
  31. else if (isalpha(wyraz[0]))
  32. {
  33.  
  34.  
  35. if( islower( wyraz[0] ) )
  36. {
  37. t1 = toupper(wyraz[0]);
  38. cout<<t1;
  39.  
  40. }
  41. else
  42. cout<<wyraz[0];
  43. }
  44. int dlugosc=wyraz.length();
  45. //dla reszty elementow
  46. for(int i=1; i<dlugosc; i++)
  47. {
  48. if(wyraz[i]==' ')
  49. {
  50. wyraz.erase(i,1);
  51.  
  52. if(isalpha(wyraz[i]))
  53. {
  54. if( islower( wyraz[i] ) )
  55. {
  56. t1 = toupper(wyraz[i]);
  57. cout<<t1;
  58. }
  59. else if(wyraz[i]!=' ')
  60. cout<<wyraz[i];
  61. }
  62. }
  63. else
  64. cout<<wyraz[i];
  65. }
  66. cout<<endl;
  67. }
  68. return 0;
  69. }
Success #stdin #stdout 0s 15240KB
stdin
ala ma kota
ala  ma kota
ala   ma kota
ala    ma kota
ala     ma kota
stdout
AlaMaKota
AlamaKota
AlaMaKota
AlamaKota
AlaMaKota