ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1567. SMS-spam

WA#8 plz somebody help me,its driving me insane
Posted by cena 30 Nov 2012 14:43
here's my code,what's wrong with it,i get WA on test#8.
#include <iostream>
using namespace std;

int main(){

    char str[1000];
    int sum = 0;

    for(int i = 0; str[i] != '\0'; ++i){

        if(str[i] >= 'a' && str[i] <= 'z'){

            sum += (str[i] - 97) % 3 + 1;

        }else if(str[i] == ' ' || str[i] == '.'){

            ++sum;

        }else if(str[i] == '!'){

            sum += 3;

        }else if(str[i] == ','){

            sum += 2;

        }

    }
    cout << sum;
    return 0;

}
Re: WA#8 plz somebody help me,its driving me insane
Posted by SSAU6208BNikolaychuk 15 Oct 2014 14:58
    char str[1002];