Created
April 12, 2016 22:06
-
-
Save nemanjan00/fe0a47c5093b9a1d77aeaa4c0a260091 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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