fork download
  1. #include <iostream>
  2. #include<string>
  3. using namespace std;
  4.  
  5. int main() {
  6. string s="LLLCC";
  7. int L=0;
  8. int LC=0;
  9. for(int i=0;i<s.size();i++) {
  10. if(s[i]=='L') {
  11. L++;
  12. }
  13. if(s[i]=='C') {
  14. LC+=L;
  15. }
  16. }
  17. cout<<LC;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5308KB
stdin
Standard input is empty
stdout
6