Lang:G++
Edit123456789101112131415161718192021222324#include<cstdio>char r[31];int s[26];int main(){int c=0;char ch, *p=r;s[9]=1;while((ch=getchar())!='\n' && c<25) {if(ch=='J') ch='I';if(!s[ch-'A']) {*p++=ch;s[ch-'A']=1;if(!(++c%5)) *p++='\n';}}for(int i=0; i<26 && c<25; i++) {if(!s[i]) {*p++=i+'A';if(!(++c%5)) *p++='\n';}}printf("%s", r);}