Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This code shows Visual C++ 2012 bug
- * Code by Artur "Mrowqa" Jamro
- */
- #define _CRT_SECURE_NO_WARNINGS
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- using namespace std;
- int main() {
- char word[235];
- unsigned char ch[128] = {0};
- short roz[128] = {0};
- bool isPrime[235] = { false, false, true, true, false };
- int wLen=0;
- scanf("%s", word);
- for(char*it=word,wLen=0; *it; ++it, ++wLen) // here's initialization
- ch[*it]++,roz[wLen+1]++;
- for(char i='a'; i<='z'; ++i)
- while(ch[i]) roz[ch[i]--]--;
- for(int i=4; i<=wLen; ++i) // and here's debugger error (http://puu.sh/3HAbG.png)
- if(roz[i]!=0)
- {
- int ii=i;
- for(int j=2;j<ii;++j) {
- while(ii%j==0) {
- ii/=j;
- roz[j]+=roz[i];
- }
- }
- if(ii==i)
- isPrime[ii]=true;
- else
- roz[i]=0;
- }
- int maxPrime = 2;
- for(int i=2; i<=wLen; i++)
- if(roz[i]!=0) maxPrime = i;
- for(int i=2; i<=maxPrime; ++i)
- if(isPrime[i]) printf("%i ", roz[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment