Witam,
cały czas wyskakuje mi błędna odpowiedz w zadaniu. Wpisuje wiele kombinacji i dobrze mi wychodzi. Tak już siedzę i myślę nad tym zadaniem, aż postanowiłem zapisać się do forum i utorzyć nowy wątek
Pomocy
package com.company;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String werb = sc.nextLine();
String[] array = werb.split(" ");
for (int i = 0; i < array.length; i++) {
if(array[i].length()!=0) {
String firstLetter = String.valueOf(array[i].charAt(0));
if (i != 0) {
firstLetter = firstLetter.toUpperCase();
}
String rest = array[i].substring(1);
array[i] = firstLetter + rest;
}
}
StringBuilder actualValue = new StringBuilder();
for (String s : array) {
actualValue.append(s);
}
System.out.println(actualValue);
}
}