jw910731

APCS-Alternate

Sep 7th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.     string str;
  6.     int k;
  7.     while(cin>>k>>str){
  8.         bool state = islower(str[0]); // is lower is the base of variable
  9.         int maxLen = 0;
  10.         int len=0;
  11.         for(int i=0;str.size();i++){
  12.             if(i>0 && i%k==0){//change char state
  13.                
  14.             }
  15.             if(islower(str[i]) == state){ //case condition
  16.                 len++;
  17.             }
  18.             else{
  19.                 len = 0;
  20.                 state = islower(str[i+1]);
  21.                 if(len > maxLen)
  22.                     maxLen = len;
  23.             }
  24.         }
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment