Capitalize i
This commit is contained in:
committed by
İnanç Gümüş
parent
b6ca30c4bb
commit
27c12b9b58
@ -22,29 +22,29 @@ import (
|
||||
//
|
||||
// CURRENT OUTPUT
|
||||
//
|
||||
// [all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay]
|
||||
// [all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay]
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
//
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday]
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday]
|
||||
//
|
||||
//
|
||||
// STEPS
|
||||
//
|
||||
// INITIAL SLICE:
|
||||
// [all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay]
|
||||
// [all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay]
|
||||
//
|
||||
//
|
||||
// 1. Prepend "yesterday" to the `lyric` slice.
|
||||
//
|
||||
// RESULT SHOULD BE:
|
||||
// [yesterday all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay]
|
||||
// [yesterday all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay]
|
||||
//
|
||||
//
|
||||
// 2. Put the words to the correct positions in the `lyric` slice.
|
||||
//
|
||||
// RESULT SHOULD BE:
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday]
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday]
|
||||
//
|
||||
//
|
||||
// 3. Print the `lyric` slice.
|
||||
@ -65,7 +65,7 @@ import (
|
||||
|
||||
func main() {
|
||||
// DON'T TOUCH THIS:
|
||||
lyric := strings.Fields(`all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay`)
|
||||
lyric := strings.Fields(`all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay`)
|
||||
|
||||
// ADD YOUR CODE BELOW:
|
||||
// ...
|
||||
|
@ -17,8 +17,8 @@ func main() {
|
||||
// --- Correct Lyric ---
|
||||
// yesterday all my troubles seemed so far away
|
||||
// now it looks as though they are here to stay
|
||||
// oh i believe in yesterday
|
||||
lyric := strings.Fields(`all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay`)
|
||||
// oh I believe in yesterday
|
||||
lyric := strings.Fields(`all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay`)
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// #1: Prepend "yesterday" to `lyric`
|
||||
@ -26,10 +26,10 @@ func main() {
|
||||
|
||||
//
|
||||
// --- BEFORE ---
|
||||
// all my troubles seemed so far away oh i believe in yesterday
|
||||
// all my troubles seemed so far away oh I believe in yesterday
|
||||
//
|
||||
// --- AFTER ---
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday
|
||||
//
|
||||
// (warning: allocates a new backing array)
|
||||
//
|
||||
@ -40,7 +40,7 @@ func main() {
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday
|
||||
// | |
|
||||
// v v
|
||||
// index: 8 pos: 13
|
||||
@ -49,10 +49,10 @@ func main() {
|
||||
|
||||
// --- BEFORE ---
|
||||
//
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay
|
||||
//
|
||||
// --- AFTER ---
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay oh I believe in yesterday
|
||||
// ^
|
||||
//
|
||||
// |
|
||||
@ -63,10 +63,10 @@ func main() {
|
||||
|
||||
//
|
||||
// --- BEFORE ---
|
||||
// yesterday all my troubles seemed so far away oh i believe in yesterday now it looks as though they are here to stay oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away oh I believe in yesterday now it looks as though they are here to stay oh I believe in yesterday
|
||||
//
|
||||
// --- AFTER ---
|
||||
// yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday
|
||||
//
|
||||
// (does not allocate a new backing array because cap(lyric[:N]) > M)
|
||||
//
|
||||
|
@ -27,22 +27,22 @@ import (
|
||||
//
|
||||
// ORIGINAL SLICE:
|
||||
//
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday]
|
||||
// [yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday]
|
||||
//
|
||||
// EXPECTED SLICE (NEW):
|
||||
//
|
||||
// [yesterday all my troubles seemed so far \n away now it looks as though they are here to stay \n oh i believe in yesterday \n]
|
||||
// [yesterday all my troubles seemed so far \n away now it looks as though they are here to stay \n oh I believe in yesterday \n]
|
||||
//
|
||||
//
|
||||
// CURRENT OUTPUT
|
||||
//
|
||||
// yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday
|
||||
// yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday
|
||||
//
|
||||
// EXPECTED OUTPUT
|
||||
//
|
||||
// yesterday all my troubles seemed so far away
|
||||
// now it looks as though they are here to stay
|
||||
// oh i believe in yesterday
|
||||
// oh I believe in yesterday
|
||||
//
|
||||
//
|
||||
// RESTRICTIONS
|
||||
@ -72,7 +72,7 @@ import (
|
||||
func main() {
|
||||
// You need to add a newline after each sentence in another slice.
|
||||
// Don't touch the following code.
|
||||
lyric := strings.Fields(`yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday`)
|
||||
lyric := strings.Fields(`yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday`)
|
||||
|
||||
// ===================================
|
||||
//
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
lyric := strings.Fields(`yesterday all my troubles seemed so far away now it looks as though they are here to stay oh i believe in yesterday`)
|
||||
lyric := strings.Fields(`yesterday all my troubles seemed so far away now it looks as though they are here to stay oh I believe in yesterday`)
|
||||
|
||||
// `+3` because we're going to add 3 newline characters to the fix slice.
|
||||
fix := make([]string, len(lyric)+3)
|
||||
@ -34,7 +34,7 @@ func main() {
|
||||
//
|
||||
// + The second sentence has 10 words so its cutting index is 10.
|
||||
//
|
||||
// now it looks as though they are here to stay oh i believe in yesterday
|
||||
// now it looks as though they are here to stay oh I believe in yesterday
|
||||
// |
|
||||
// v
|
||||
// cutting index: 10
|
||||
@ -42,7 +42,7 @@ func main() {
|
||||
//
|
||||
// + The last sentence has 5 words so its cutting index is 5.
|
||||
//
|
||||
// oh i believe in yesterday
|
||||
// oh I believe in yesterday
|
||||
// |
|
||||
// v
|
||||
// cutting index: 5
|
||||
|
Reference in New Issue
Block a user