fork download
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "unicode"
  6. )
  7.  
  8. func main() {
  9. saneAdvice := "Don’t make the mistake of trading on margin simply due to greed or desperation to make up for lost ground."
  10. result := make([]rune, len(saneAdvice))
  11.  
  12. for i, j := range saneAdvice {
  13. if i%2 == 1 {
  14. result[i] = unicode.ToLower(j)
  15. } else {
  16. result[i] = unicode.ToUpper(j)
  17. }
  18. }
  19. fmt.Println(string(result))
  20. }
Success #stdin #stdout 0s 3072KB
stdin
Standard input is empty
stdout
DoN’T MaKe tHe mIsTaKe oF TrAdInG On mArGiN SiMpLy dUe tO GrEeD Or dEsPeRaTiOn tO MaKe uP FoR LoSt gRoUnD.