coderrohan14

StringQ2.java

Jul 3rd, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Solution {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. char[] arr = sc.next().toCharArray();
  7. int n = arr.length;
  8. int cnt=0;
  9. for(int i=0;i<n;i++){
  10. if(Character.isUpperCase(arr[i])){
  11. cnt++;
  12. }
  13. }
  14. cnt++;
  15. System.out.println(cnt);
  16. }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment