Skip to content

Instantly share code, notes, and snippets.

@nemanjan00
Created April 12, 2016 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemanjan00/fe0a47c5093b9a1d77aeaa4c0a260091 to your computer and use it in GitHub Desktop.
Save nemanjan00/fe0a47c5093b9a1d77aeaa4c0a260091 to your computer and use it in GitHub Desktop.
package com.mycompany.app;
import java.util.Scanner;
public class App{
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
for(int i = 0; i < str.length(); i++){
if((i > 0 && str.charAt(i - 1) == ' ') || i == 0){
str = str.substring(0, i) + Character.toUpperCase(str.charAt(i)) + str.substring(i + 1);
}
}
System.out.println(str);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment