---
# System prepended metadata

title: 230118 CS note - Edison
tags: [Java, Programming, CWL, Cooper]

---

# 230118 CS note - Edison
###### tags: `Cooper` `CWL` `Programming` `Java`



## Class 
### String-2 > countCode
```java
public int countCode(String str) {
      
      int i1 = str.indexOf("co");
      String j1 = "";
      int i = str.length();
      if(i1 != -1){
        j1 = str.substring(i1,i); // substring starting from "co"
      }
      int ans = 0;

      while(i1 != -1){
          
          //System.out.println(j1);
          
          if(j1.length()<4){
             break;
          }
          
          if(j1.charAt(3)=='e'){
            ans++;
          }
          i = j1.length();
          i1 = j1.substring(2,i).indexOf("co");
          j1 = j1.substring(i1+2,i);
        }
        
      return ans;
    }

```

## Homework

### Basic
- [x] [Firstlast6](https://codingbat.com/prob/p185685)
- [x] [teaParty](https://codingbat.com/prob/p177181)
- [x] [middleThree](https://codingbat.com/prob/p115863)

### Medium
- [x] [Lucky13](https://codingbat.com/prob/p194525)
- [x] [makeBricks](https://codingbat.com/prob/p183562)

