fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner sc = new Scanner(System.in);
  13. while(sc.hasNextLine())
  14. {
  15. String line = sc.nextLine();
  16. StringBuilder outLine = new StringBuilder();
  17.  
  18. boolean spaceBefore = false;
  19.  
  20. int len = line.length();
  21. for(int i = 0; i < len; ++i) {
  22. char c = line.charAt(i);
  23. if (c == ' ') {
  24. spaceBefore = true;
  25. } else {
  26. if (spaceBefore) {
  27. c = Character.toUpperCase(c);
  28. }
  29. outLine.append(c);
  30. spaceBefore = false;
  31. }
  32. }
  33.  
  34. System.out.println(outLine);
  35. }
  36. }
  37. }
Success #stdin #stdout 0.15s 321344KB
stdin
Dzisiaj jest czwartek,
A jutro bedzie piatek.
test Bledu Testu.
stdout
DzisiajJestCzwartek,
AJutroBedziePiatek.
testBleduTestu.