#Java 7,<del>431 317 </del> 311bytes *Thanks to @KevinCruijssen for **114** bytes.* <br> *Thanks to @RosLup for saving **6** bytes.* <!-- language-all: lang-java --> String c(String s){String v="",x,l[]=s.split(" "),b[]={"a","an","the","at","but,"by","for","in","of","on","to","up","as","or","and","nor"};int i=0,f=0,z=0;for(String c:l){for(f=0;f<b.length;z=c.equals(b[f++])|z>0?1:0);x=(char)(c.charAt(0)-32)+c.substring(1);v+=(z>0?i<1|i>l.length-2?x:c:x)+" ";i++;}return v;} #ungolfed first answer above 250 bytes static String c(String s) { String v = "", x, l[] = s.split(" "), b[]={"a","an","the","at","by","for","in","of","on","to", "up","and","as","or","nor","but"}; int i , f , z = i = f = 0; for (String c : l) { for (f = 0; f < b.length; z = c.equals( b[f++] ) | z > 0 ? 1 : 0); x = (char)(c.charAt(0) - 32) + c.substring(1); v += (z > 0 ? i < 1 | i > l.length - 2 ? x : c : x) + " "; i++; } return v; }